﻿<!--#include file="Adojavas.inc"-->
<!--#include file="Cusjavas.asp"-->
<!--#include file="Configure.asp" -->
<%  
/*  Prototype JScript framework, version 1.1.0
 *  No(c) 2008 jusa wong <jusa.wong@gmail.com>
 *  Thanks Sam and everyBody
/*--------------------------------------------------------------------------*/
Response.Charset='UTF-8';
Response.Buffer=true;
/*--------------------------------------------------------------------------*/
var Prototype = {
  Version: '1.0.0',
  ScriptEngine:'SciptEngine:'+ScriptEngine()+' BuildVersion:'+ScriptEngineBuildVersion()+' MMVersion:'+ScriptEngineMajorVersion()+'.'+ScriptEngineMinorVersion(),
  emptyFunction: function() {}
}
//类定义
	var Class = {
	  create: function() {
		return function() {
		  this.initialize.apply(this, arguments);
		}
	  }
	}
	  Object.isFunction= function(object) {
    return typeof object == "function";
  }

//类继承
	var Abstract = new Object();
	Object.varType=function($var)
	{
		//int,float,bool,string,array,date,json,function
		var varType=typeof($var);
		if(varType=='object')
		{
			switch($var.constructor)
			{
				case Array:
					varType='array';
					break;
				case Date:
					varType='date';
					break;					
				case Object:
					varType='json';
					break;
				default:
					varType='object';					
			}
		}
		else if(varType=='number')
		{
			varType=(parseInt($var)==$var) ? ('int'):('float');
		}
		return varType;
	};	
	
	Object.extend = function(destination, source) {
		
	  for (var property in source) 
	  {
			destination[property] = source[property];
	  }
	  return destination;
	}
	
//	Object.prototype.extend = function(object) {
//	  return Object.extend.apply(this, [this, object]);
//	}
			Object.clear=function($object)
			{
				for(var iObject in $object){
					delete this[iObject];
				}	
			}
/* {@} Javascript 对象扩展--------------------------------------------------------------------------*/
//扩展Object		
//扩展Array
	Object.extend
	(
		Function.prototype,
		{
			argumentNames:function() 
			{
				var names=this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
				return (names.length==1&&names[0]==undefined) ? []:names;
			},
			bind:function() 
			{
				if(arguments.length<2&&arguments[0]===undefined)
				{
					return this;
				}

var __method=this,args=$A(arguments),object=args.shift();
				return function()
				{					
					return __method.apply(object,args.concat($A(arguments)));
				}
			}
		}
	)
	var Enumerable=
	{
		all:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _result=true;
			this.each
			(
				function($value,$index) 
				{					
					_result=_result&&!!$iterator($value,$index);
					if(!_result) throw cusFrameworkDo$Break;
				}
			);
			return _result;
		},	
		any:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _result=false;
			this.each
			(
				function($value,$index) 
				{
					if(_result=!!$iterator($value,$index))
					throw cusFrameworkDo$Break;
				}
			);
			return _result;
		},	
		collect:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _results=[];
			this.each
			(
				function($value,$index) 
				{
					_results.push($iterator($value,$index));
				}
			);
			return _results;
		},	
		detect:function($iterator,$context) 
		{
			$iterator=$iterator.bind($context);
			var _result;
			this.each
			(
				function($value,$index) 
				{
					if($iterator($value,$index)) 
					{
						_result=$value;
						throw cusFrameworkDo$Break;
					}
				}
			);
			return _result;
		},		
		each:function($iterator,$context) 
		{
			var _index=0;
			$iterator=$iterator.bind($context);
			try 
			{
				this._each
				(
					function($value)
					{
						$iterator($value,_index++);
					}
				);
			}catch(e) 
			{
				if(e!=cusFrameworkDo$Break) throw e;			
			}
			return this;
		},	
		eachSlice:function($number,$iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _index=-$number,_slices=[],_array=this.toArray();
			while((_index+=$number)<_array.length)
			{						
				_slices.push(_array.slice(_index,_index+$number));				
			}
			return _slices.collect($iterator,$context);
		},		
		findAll:function($iterator,$context) 
		{
			$iterator=$iterator.bind($context);
			var _results=[];
			this.each
			(
			 	function($value,$index) 
				{
					if($iterator($value,$index))
					_results.push($value);
				}
			);
			return _results;
		},	
		grep:function($filter,$iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _results=[];			
			if(Object.isString($filter)){
				$filter=new RegExp($filter);
			}			
			this.each
			(
				function($value,$index) 
				{
					if($filter.match($value)){
						_results.push($iterator($value,$index));
					}
				}
			);
			return _results;
		},
		include:function($object) 
		{
			if(Object.isFunction(this.indexOf))			
				if(this.indexOf(object) != -1) return true;			
			var _found=false;
			this.each
			(
				function($value) 
				{
					if($value==$object) 
					{
						_found = true;
						throw cusFrameworkDo$Break;
					}
				}
			);
			return _found;
		},	
		inGroupsOf:function($number,$fillWith) 
		{
			$fillWith=$fillWith===undefined ? null:$fillWith;
			return this.eachSlice
			(
			 	$number,
				function($slice)
				{												   
					while($slice.length<$number) 
					{
						$slice.push($fillWith);
					}
					return $slice;
				}
			);
		},	
		inject:function($memo,$iterator,$context) 
		{	
			$iterator=$iterator.bind($context);	
			this.each
			(
				function($value,$index) 
				{					
					$memo=$iterator($memo,$value,$index);
				}
			);
			return $memo;
		},
		inspect:function() 
		{
			return '#<Enumerable:' + this.toArray().inspect() + '>';
		},		
		invoke:function($method) 
		{
			var _args=$A(arguments).slice(1);
			return this.map
			(
				function($value) 
				{
					return $value[$method].apply($value,_args);
				}
			);
		},	
		max:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _result;
			this.each
			(
				function($value,$index) 
				{
					$value=$iterator($value,$index);
					if(_result==undefined||$value>=_result)
					_result=$value;
				}
			);
			return _result;
		},	
		min:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _result;
			this.each
			(
				function($value,$index) 
				{
					$value=$iterator($value,$index);
					if(_result==undefined||$value<_result)
					_result=$value;
				}
			);
			return _result;
		},	
		partition:function($iterator,$context) 
		{
			$iterator=$iterator ? $iterator.bind($context):cusFrameworkDoPrototypeK;
			var _trues=[],_falses=[];
			this.each
			(
				function($value,$index) 
				{
					($iterator($value,$index) ? _trues:_falses).push($value);
				}
			);
			return [_trues,_falses];
		},	
		pluck:function($property) 
		{
			var _results=[];
			this.each
			(
				function($value) 
				{
					_results.push($value[$property]);
				}
			);
			return _results;
		},	
		reject:function($iterator,$context) 
		{
			$iterator=$iterator.bind($context);
			var _results=[];
			this.each
			(
				function($value,$index) 
				{
					if(!$iterator($value,$index))
					_results.push($value);
				}
			);
			return _results;
		},	
		size:function() 
		{
			return this.toArray().length;
		},			
		sortBy:function($iterator,$context) 
		{
			$iterator=$iterator.bind($context);
			return this.map
			(
				function($value,$index) 
				{					
					return {value:$value,criteria:$iterator($value,$index)};
				}
			).sort
			(
				function($left,$right) 
				{						
					var _$a=$left.criteria,_$b=$right.criteria;
					return _$a<_$b ? -1:(_$a>_$b ? 1:0);
				}
			).pluck('value');
		},	
		toArray:function() 
		{
			return this.map();
		},	
		zip:function() 
		{
			var _iterator=cusFrameworkDoPrototypeK,_args=$A(arguments);
			if(Object.isFunction(_args.last()))
				_iterator=_args.pop();
			
			var _collections=[this].concat(_args).map($A);
			return this.map
			(
				function($value,$index) 
				{					
					return _iterator(_collections.pluck($index));
				}
			);
		}
	};
	//->别名
	Object.extend
	(
		Enumerable, 
		{
			map:Enumerable.collect,
			find:Enumerable.detect,
			select:Enumerable.findAll,
			filter:Enumerable.findAll,
			member:Enumerable.include,
			entries:Enumerable.toArray,
			every:Enumerable.all,
			some:Enumerable.any
		}
	);	

	Object.extend
	(
	 	String.prototype,
		{		
			//->匹配处理字符串,返回处理结果
			gsub:function($pattern,$replacement) 
			{
				var result='',source=this,match;
				$replacement=arguments.callee.prepareReplacement($replacement);	
				while(source.length>0) 
				{
					if(match=source.match($pattern)) 
					{								
						result+=source.slice(0,match.index);
						result+=String.interpret($replacement(match));
						source=source.slice(match.index+match[0].length);
					} 
					else{
						result+=source,source='';
					}
				}
				return result;
			}
		}
	);
		String.prototype.gsub.prepareReplacement=function($replacement) 
	{
		if(Object.isFunction($replacement)) return $replacement;
		var template=new Template($replacement);
		return function(match){return template.evaluate(match)};
	};



	Object.extend
	(
	 	String, 
		{
			interpret:function($value) 
			{
				return $value==null ? '':String($value);
			},
			specialChar:
			{
				'\b':'\\b',
				'\t':'\\t',
				'\n':'\\n',
				'\f':'\\f',
				'\r':'\\r',
				'\\':'\\\\'
			}
		}
	);
			String.prototype.startsWith=function($pattern) 
			{
				return this.indexOf($pattern)===0;
			}



Object.extend(Array.prototype,Enumerable);
	Object.extend
	(
		Array.prototype,
		{
			//->遍历数组元素
			_each:function($iterator) 
			{
				for(var _i=0,_length=this.length;_i<_length;_i++)
				$iterator(this[_i]);
			}
		}
	);
	Array.prototype.isRealArray=function()
	{
		return (this.length==1) ? (this[0]==undefined ? false:true):true;
	}
	Array.prototype.indexOf=function($object)
	{
		for (var i = 0, length = this.length; i < length; i++)
		if (this[i] == $object) return i;
		return -1;		
	};
	
	/* {#} Array Function --------------------------------------------------------------------------*/	
//扩展String
			String.prototype.stripTags=function() 
			{
				return this.replace(/<\/?[^>]+>/gi,'');
			}
			//->去除空格
			String.prototype.strip=function() 
			{
				return this.replace(/^\s+/,'').replace(/\s+$/,'');
			}
			//->去除标签
			String.prototype.stripTags=function() 
			{
				return this.replace(/<\/?[^>]+>/gi,'');
			}
			//->去除脚本
			String.prototype.stripScripts=function() 
			{
				return this.replace(new RegExp('<script[^>]*>([\\S\\s]*?)<\/script>','img'),'');
			}
	String.prototype.isDateString=function()
	{
		return /(\d{4})\-(\d{1,2})\-(\d{1,2})\s(\d{1,2})\:(\d{1,2})\:(\d{1,2})/gi.test(this)||/^(\d{4})-(\d{1,2})-\d{1,2}$/.test(this);
	}	
	String.prototype.toBytes = function()
	{
		var ret=[];
		for(var i=0;i<this.length;i++)
		{
			var u=this.charCodeAt(i);
			ret.push(u >> 8);			//右移8位获得高字节
			ret.push(u & 0xFF);			//逻辑与0xFF获得低字节
		}
		return ret;
	};		
	String.prototype.trim=function()
	{
		return this.replace(/(^[\s]*)|([\s]*$)/g, "");
	}	
	String.prototype.ltrim=function()
	{
		return this.replace(/(^[\s]*)/g, "");
	}
	String.prototype.rtrim=function()
	{
		return this.replace(/([\s]*$)/g, "");
	}
	String.prototype.left=function(len)
	{
		if(isNaN(len)||len==null)
		{
			len = this.length;
		}
		else
		{
			if(parseInt(len)<0||parseInt(len)>this.length)
			{
				len = this.length;
			}
		}		   
		return this.substr(0,len);			
	}
	String.prototype.right=function(len)
	{
		if(isNaN(len)||len==null)
		{
				len = this.length;
		}
		else
		{
			if(parseInt(len)<0||parseInt(len)>this.length)
			{
					len = this.length;
			}
		}		   
		return this.substring(this.length-len,this.length);		
	}		
	String.prototype.isChineseString=function()
	{
		return /[\u4e00-\u9fa5]/.test(this);	
	}	
	/* {#} String Function --------------------------------------------------------------------------*/
		//将"日期时间的数字"格式化成文本并不足两位加0
		String.prototype.toDateText=function()
		{
			if(this.length==1)
			{
				return '0'+this; 	
			}
			return this;
		}		
		//格式化文本框
		String.prototype.formatText=function() 
		{
			var result=this;
				result=result.replace(/>/g,'&gt;');
				result=result.replace(/</g,'&lt;');					
				result=result.replace(/\n/g,'<br/>');
				result=result.replace(/\t/g,'&nbsp;&nbsp;&nbsp;&nbsp;');
				result=result.replace(/\s/g,'&nbsp;&nbsp;');			
			return result;
		}		
		//对字符串分页
		String.prototype.pagination=function($type)
		{
			$type=($type==undefined ? '<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>':'<!-- pagebreak -->');
			if(this==undefined||this=='') 
				return this;
			var isToPagination=false;			
			if(this.indexOf($type)!=-1)
			{			
				var infoArray=this.split('<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>');
				var infopage=($$$("page")==String(undefined) ? 1:parseInt($$$("page")));
					if(isNaN(infopage)) infopage=1;		
				if(infopage<1) infopage=1;
				if(infopage>infoArray.length+1) infopage=parseInt(infoArray.length);
				doc(infoArray[infopage-1]);
				isToPagination=true;
			}
			else
			{
				doc(this)
			}
			var css=new CssDoc();
				css.begin();
					css.doc('.infoPagination{padding-top:10px;}');
				css.end();
			doc('<div align="center" class="infoPagination">');
				if(isToPagination==true)
				{
					if(infopage==undefined||(infopage<=1))
						doc('<a style="color:#cccccc;">[首页]</a> <a style="color:#cccccc;">[上一页]</a>');
					else
						doc('<a href="?id='+$$("id")+'&page=1">[首页]</a> <a href="?id='+$$("id")+'&page='+parseInt(infopage-1)+'">[上一页]</a>');	
					
					if(infopage>=parseInt(infoArray.length))
						doc('<a style="color:#cccccc;">[下一页]</a> <a style="color:#cccccc;">[尾页]</a>');
					else
						doc('<a href="?id='+$$("id")+'&page='+parseInt(infopage+1)+'">[下一页]</a> <a href="?id='+$$("id")+'&page='+(parseInt(infoArray.length))+'">[尾页]</a>');
				}
			doc('</div>');
		}	
		//截取字符串
		String.prototype.cut=function($length,$method)
		{		
			var result;
			if(isNaN($length)||$length==0) return false;
			if(this==undefined||this=='') return false;
			$method=='right'||$method=='r' ? result=this.substring(this.length,this.length-$length) : result=this.substr(0,$length);
			if(this.length>result.length) result+='..';
			return result;
		} 		
//$ 扩展Number	对象方法
	//# 验证是否为整数
	Number.prototype.isInteger=function()
	{
		return parseInt(this)==this;
	};	
	Number.prototype.formatNumber=function(pointPsti)
	{
		 if(this=='')return false;
		 if(typeof(pointPsti)=='undefined'){
			 var pointPsti=3;
		 } else { if(isNaN(pointPsti)){pointPsti=3}; }
		 var num=this+'', numDc='', temp='';
		 if(num.indexOf('.')>-1){ ptPs=num.indexOf('.'); numDc=num.substr(ptPs); num=num.substr(0,ptPs); }
		 for(var i=num.length-1; i>=0;temp+=num.substr(i,1), i--);
		 var re=new RegExp('(.{'+pointPsti+'})','g');
			 temp=temp.replace(re,'$1,'); num='';                
		 for(var i=temp.length-1; i>=0; num+=temp.substr(i,1), i--);
			 num=num.replace(/^\,|\,$/,'')+numDc;
		 return num; // shawl.qiu script
	}
	//数字的位数
	Number.prototype.length=function()
	{
		return this.toString().length;
	}	
	//将"日期时间的数字"格式化成文本并不足两位加0
	Number.prototype.toDateText=function()
	{
		if(this.length()==1)
		{
			return '0'+this; 	
		}
		return this;
	}
	//格式化小数
	Number.prototype.toFloat=function($dd)
	{
		var dd=($dd==undefined) ? 2:$dd;
		var value0=Math.round(this*Math.pow(10,dd))/Math.pow(10,dd)+'';  
		var value1=value0.split('.');  
		if(value1.length==1){
			return(value0+"."+(Math.pow(10,dd)+'').substr(1));  
		}else{
			return(value1[0]+"."+(value1[1]+(Math.pow(10,dd)+'').substr(1)).substring(0,dd));  		
		}
	};
	//#转化成百分数
	Number.prototype.toPercent=function($dd)
	{
		//$dd(Decimal digits) -> 保留位数 
		return ($dd==undefined||isNaN($dd)||Numeric.isInteger($dd)==false) ? ((this*100)+'%') : ((this*100).toFixed($dd)+'%');
	};	
//$ 扩展Number对象函数
	var Numeric=
	{
		//# 验证是否为整数
		isInteger:function($value)
		{
			return (isNaN($value)==true) ? (false):(parseInt($value)!=$value ? false:true);
		},
		//# 验证是否为浮点数
		isFloat:function($value)
		{
			//注:包含浮点数字符串
			return /^-?([0-9]\d*\.\d*|0\.\d*[0-9]\d*|0?\.0+|0)$/.test(this); 
		}				
	};


//扩展Date对象
	Date.prototype.diff=function($type,$datetime)
	{		
		return Date.aide.diff($type,$datetime,this);
	};
	Date.prototype.toASPString=function()
	{
		return this;
	}
	Date.now=function($type)
	{
		//$type object:返回对象,string:返回字符串,默认值 :object
		if($type=='string')
		{
			return Dater.now.datetime;
		}
		return new Date();
	};
	Date.diff=function($type,$start,$end)
	{
		return Date.aide.diff($type,$start,$end)
	};
	Date.aide=
	{
		//解析各种时间对象，并返回JScript Date对象
		parse:function($datetime)
		{
			var _dateObj;
			switch(typeof($datetime))
			{
				case 'undefined':
					_dateObj=new Date();	
					break;
				case 'string':
					if(/\w{3}\s{1}\w{3}\s{1}\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}\s{1}UTC\+\d{4}\s{1}\d{4}/gi.test($datetime))
					{
						_dateObj=new Date(Object($datetime))
					}
					else if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($datetime)||/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($datetime))
					{
						if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($datetime))
						{
							_dateObj=new Date($datetime.split('-')[0],Number($datetime.split('-')[1])-1,$datetime.split('-')[2]);
						}
						if(/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($datetime))
						{
							var dateArray=$datetime.split(' ');
							var date0=dateArray[0].split('-'),date1=dateArray[1].split(':');
							_dateObj=new Date(date0[0],Number(date0[1])-1,date0[2],date1[0],date1[1],date1[2]);
						}
					}
					else
						_dateObj=new Date();
					break;
				case 'object':
					_dateObj=new Date($datetime);	
					break;
				default:
					_dateObj=new Date();	
			}	
			return _dateObj;
		},
		diff:function($type,$start,$end)
		{
			var _typeEnum=['y','q','m','w','d','h','mm','s','ms'];
				if(_typeEnum.indexOf($type)==-1)
				{
					doc('Date 对象错误，diff方法需要一个明确的计算时间间隔的值! 在 Prototype.asp 中。');
					_typeEnum=null;
					over();
				}
			var _dateObj0=Date.aide.parse($start),_dateObj1=Date.aide.parse($end);
			var _value;
			switch($type)
			{
				case _typeEnum[0]: 	//年
					_value=Math.floor((_dateObj1-_dateObj0)/1000/60/60/24/365)<0 ? 1:Math.floor((this-dateObj)/1000/60/60/24/365);
					break;
				case _typeEnum[1]: 	//年
					_value=Math.floor((_dateObj1-_dateObj0)/1000/60/60/24/365)<0 ? 1:Math.floor((this-dateObj)/1000/60/60/24/90);
					break;					
				case _typeEnum[2]:	//月
					_value=Math.floor((_dateObj1-_dateObj0)/1000/60/60/24/30)<0 ? 1:Math.floor((this-dateObj)/1000/60/60/24/30);
					break;
				case _typeEnum[3]:	//周
					_value=Math.floor((_dateObj1-_dateObj0)/1000/60/60/24/7)<0 ? 1:Math.floor((this-dateObj)/1000/60/60/24/7);
					break;
				case _typeEnum[4]: 	//日 
					_value=(_dateObj1-_dateObj0)/1000/60/60/24;
					break;									
				case _typeEnum[5]: 	//时
					_value=(_dateObj1-_dateObj0)/1000/60/60;
					break;
				case _typeEnum[6]: 	//分
					_value=(_dateObj1-_dateObj0)/1000/60;
					break;
				case _typeEnum[7]: 	//秒
					_value=(_dateObj1-_dateObj0)/1000;
					break;	
				case _typeEnum[8]: 	//毫秒	
					_value=_dateObj1-_dateObj0;													
					break;
				default:	//日
					_value=Math.floor((_dateObj1-_dateObj0)/1000/60/60/24);			
			}
			return _value;
		},
		toASPString:function($datetime)
		{
			return $datetime;
		}
	};
/* {@} 重构ASP对象--------------------------------------------------------------------------*/
//数据库链接对象
	var Connection=Class.create();
		Connection.prototype=
		{
			initialize:function($options)
			{
				this.setOptions($options);
				this.obj=Server.CreateObject("ADODB.Connection");
				switch(this.options.DriverType)
				{
					case 'Access':
						this.connStr='Driver={Microsoft Access Driver (*.mdb)};'+'Dbq='+this.dataBasePath();
						break;
					case 'Provider':
						this.connStr='provider=Microsoft.Jet.OLEDB.4.0;'+'Data Source='+this.dataBasePath();
						break;
					case 'SqlServer':
						this.connStr='driver={SQL server};'+'server='+this.options.SqlServerOptions.server+';uid='+this.options.SqlServerOptions.uid+';pwd='+this.options.SqlServerOptions.pwd+';database='+this.options.DataBase;	
						break;
					case 'ODBC':
						break;
					default:
						this.connStr=this.Driver.Access+Server.MapPath(this.options.DataBase);
				}
				//------/
				try
				{
					this.obj.Open(this.connStr);			
				}
				catch(e)
				{
					if(Configure.Application.state=='Debug')
					{
						echo('Connection对象执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
						echo(this.connStr);
					}
					else
					{
						doc('程序发生意外，请与管理员联系。');	
					}
					over();						
				}
				//------/
			},
			setOptions:function($options)
			{	
				this.options=
				{
					DataBase:Configure.Database.path,
					DriverType:Configure.Database.type,
					AccessPathType:Configure.Database.pathType,
					SqlServerOptions:
					{
						server:Configure.Database.sqlServerOptions.server,
						uid:Configure.Database.sqlServerOptions.userid,
						pwd:Configure.Database.sqlServerOptions.password
					}				
				};			
				if($options!=undefined) Object.extend(this.options,$options)
			},
			dataBasePath:function()
			{
				if((this.options.DriverType=='Access'||this.options.DriverType=='Provider')&&this.options.AccessPathType=='Absolute')	
				{
					return this.options.DataBase;
				}
				else
				{				
					return Server.MapPath(Database.path(this.options.DataBase));
				}
			},
			state:function()
			{
				echo('数据库名称或路径:'+this.options.DataBase);
				if(this.options.DriverType=='Access'||this.options.DriverType=='Provider') echo('数据路径类型'+this.options.AccessPathType);			
				echo('数据库驱动类型'+this.options.DriverType);
				echo('数据库驱动'+this.connStr);						
				if(this.options.DriverType=='SqlServer')
				{
					echo(this.options.SqlServerOptions.server);
					echo(this.options.SqlServerOptions.uid);
					echo(this.options.SqlServerOptions.pwd);			
				}
			},
			close:function()
			{
				this.obj.close();
				this.obj=null;		
			}
		};
//数据集对象	
	var Recordset=Class.create();
		Recordset.prototype=
		{
			initialize:function($sql,$options)
			{
				this.setOptions($options);
				this.c=new Connection();										
				this.obj=Server.CreateObject("ADODB.Recordset");
				this.obj.CursorLocation=3;
				//------/
				try
				{
					this.obj.Open($sql,this.c.obj,this.options.CursorType,this.options.LockType);
				}
				catch(e)
				{
					  if(Configure.Application.state=='Debug')
					  {
						  echo('Recordset执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
						  echo($sql);
					  }
					  else
					  {
						  doc('程序发生意外，请与管理员联系。');	
					  }
					  over();					
				}
				//------/
				if(this.options.RsType=="Page")
				{
					if(!(this.obj.eof&&this.obj.bof))
					{
						
						if(this.pagesNull()) this.options.PageSize=10;
						this.obj.PageSize=this.options.PageSize;
						if(this.pagesNull(this.options.absolutePage)) this.options.absolutePage=1;
						if(this.options.absolutePage=='') 
							this.options.absolutePage=1;
						else
						{
							if(isNaN(this.options.absolutePage))							
							{
								this.options.absolutePage=1;
							}
							else
							{
								if(parseInt(this.options.absolutePage)<1)
								{
									this.options.absolutePage=1;
								}
								else if(parseInt(this.options.absolutePage)>=this.obj.PageCount)
								{
									this.options.absolutePage=this.obj.PageCount;					
								}								
							}
						}
						this.obj.AbsolutePage=this.options.absolutePage;
					}							
				}				
			},
			setOptions:function($options)
			{		
				var RsType,Adcursor,Adlock;
					$options=(($options==undefined) ? {}:$options);
				var PageParameterName=[$options.PageParameterName==undefined||$options.PageParameterName=='' ? 'Page':$options.PageParameterName];				
					switch($options.RsType)
					{
						case "Common":
							RsType='Common',Adcursor=[$options.CursorType==undefined||(isNaN($options.CursorType)||($options.CursorType>3||$options.CursorType<0)) ? 3:$options.CursorType],Adlock=[$options.LockType==undefined||(isNaN($options.LockType)||($options.LockType>3||$options.LockType<0)) ? 1:$options.LockType];
							break;
						case "Data":
							RsType='Data',Adcursor=[$options.CursorType==undefined||(isNaN($options.CursorType)||($options.CursorType>3||$options.CursorType<0)) ? 3:$options.CursorType],Adlock=[$options.LockType==undefined||(isNaN($options.LockType)||($options.LockType>3||$options.LockType<0)) ? 2:$options.LockType];
							break;
						case "Page":
							RsType='Page',Adcursor=[$options.CursorType==undefined||(isNaN($options.CursorType)||($options.CursorType>3||$options.CursorType<0)) ? 3:$options.CursorType],Adlock=[$options.LockType==undefined||(isNaN($options.LockType)||($options.LockType>3||$options.LockType<0)) ? 3:$options.LockType];
							break;
						default:
							RsType='Common',Adcursor=[$options.CursorType==undefined||(isNaN($options.CursorType)||($options.CursorType>3||$options.CursorType<0)) ? 3:$options.CursorType],Adlock=[$options.LockType==undefined||(isNaN($options.LockType)||($options.LockType>3||$options.LockType<0)) ? 1:$options.LockType];
					}	
					
					this.options=
					{
						RsType:RsType,			//Common Data Page
						CursorType:Adcursor,
						LockType:Adlock,
						PageSize:10,
						PageParameterName:PageParameterName,
						absolutePage:Request.QueryString(PageParameterName),
						requestParameters:[]
					};					
					if($options!=undefined) Object.extend(this.options,$options);	
						
			},
			setPaginationOptions:function($options)
			{
				this.paginationOptions={
					unit:'条',
					lab:'信息',					
					detail:false,
					pageSize:2,
					pageStyle:'numPage1',
					buttons:'chinese',					
					parameters:[]
				};
				Object.extend(this.paginationOptions,$options);
			},		
			pagesNull:function()
			{
				return this.options.PageSize==undefined||this.options.PageSize==null||this.options.PageSize==''||this.options.PageSize==0;		
			},
			state:function()
			{
				echo('对象类型:'+this.options.RsType);
				echo('游标0:'+this.options.CursorType);
				echo('游标1:'+this.options.LockType);
				if(this.options.RsType=='Page')
				{
					echo('条/页:'+this.options.PageSize);
					echo('当前:'+this.options.absolutePage+'页');
				}
			},
			makeParameters:function()
			{
				var parameters=[],parameterText='';
				if(this.options.requestParameters!=undefined&&this.options.requestParameters.constructor==Array&&this.options.requestParameters.length>0)
				{
					for(var p=0;p<=this.options.requestParameters.length-1;p++)
					{
						if(this.options.requestParameters[p].indexOf('undefined')!=-1) continue;
						parameters.push(this.options.requestParameters[p]);
					}
				}
				if(this.paginationOptions.parameters!=undefined&&this.paginationOptions.parameters.constructor==Array&&this.paginationOptions.parameters.length>0)
				{
					for(var p=0;p<=this.paginationOptions.parameters.length-1;p++)
					{
						if(this.paginationOptions.parameters[p].indexOf('undefined')!=-1) continue;
						parameters.push(this.paginationOptions.parameters[p]);
					}
				}	
				for(var p=0;p<=parameters.length-1;p++)
				{					
					var tempText=(p==[parameters.length-1]) ? parameters[p]:parameters[p]+'&';
						parameterText+=tempText;
				}	
				return parameterText;	
			},
			toStringPagination:function($options)
			{				
				var tempText='';
				if(this.obj.PageCount<=1) return false;
				var _lable=['[首 页]','[上一页]','[下一页]','[末 页]'];
				this.setPaginationOptions($options);
				var parameters=this.makeParameters();	
				var absolutePage=Number(this.options.absolutePage);
				if(absolutePage==1)
				{
					doc('<span style="color:darkgray;">'+_lable[0]+' '+_lable[1]+' </span>');
				}
				else
				{
					if(parameters!='')
						doc('<a href="?'+this.options.PageParameterName+'=1&'+parameters+'">'+_lable[0]+'</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'&'+parameters+'">'+_lable[1]+'</a> ');
					else
						doc('<a href="?'+this.options.PageParameterName+'=1">'+_lable[0]+'</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'">'+_lable[1]+' </a> ');
				}
				if(absolutePage==this.obj.PageCount)
				{	
					doc('<span style="color:darkgray;">'+_lable[2]+' '+_lable[3]+' </span>');			
				}
				else
				{
					if(parameters!='')
						doc('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'&'+parameters+'">'+_lable[2]+' </a>  <a href="?'+this.options.PageParameterName+'='+(this.obj.PageCount)+'&'+parameters+'">'+_lable[3]+'</a> ');
					else
						doc('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'">'+_lable[2]+'</a> <a href="?'+this.options.PageParameterName+'='+this.obj.PageCount+'">'+_lable[3]+'</a> ');					
				}				
				//详细信息
				if(this.paginationOptions.detail==true)
				{
					doc('页次：'+absolutePage+'/'+this.obj.PageCount+'页 ');
					doc('共'+this.obj.RecordCount+''+this.paginationOptions.unit+''+this.paginationOptions.lab+' ');
					doc(''+this.obj.PageSize+''+this.paginationOptions.unit+''+this.paginationOptions.lab+'/页 ');
					doc('<select name="select" id="select" onchange="jumpMenu(this,\''+parameters+'\');">\n');
						doc('<option value="">转到</option>');
						for(var ipage=1;ipage<=this.obj.PageCount;ipage++)	
						{
							doc('<option value="'+ipage+'">'+ipage+'</option>\n');					
						}
					doc('</select>');
					var js=new JsDoc();
						js.begin();
							js.doc('function jumpMenu($selected,$para)');
							js.doc('{');
							js.doc('if($para==\'\'||$para==undefined)');
							js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value;');
							js.doc('else');
							js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value+"&"+$para;');
							js.doc('}');
						js.end();
				}			
			},
			toStringPaginationReturn:function($options)
			{				
				var tempText='';				
				if(this.obj.PageCount<=1) return '';
				var _lable=['[首 页]','[上一页]','[下一页]','[末 页]'];
				this.setPaginationOptions($options);
				var parameters=this.makeParameters();	
				var absolutePage=Number(this.options.absolutePage);
				
				if(absolutePage==1)
				{
					tempText+=('<span style="color:darkgray;">'+_lable[0]+' '+_lable[1]+' </span>');
				}
				else
				{
					if(parameters!='')
						tempText+=('<a href="?'+this.options.PageParameterName+'=1&'+parameters+'">'+_lable[0]+'</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'&'+parameters+'">'+_lable[1]+'</a> ');
					else
						tempText+=('<a href="?'+this.options.PageParameterName+'=1">'+_lable[0]+'</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'">'+_lable[1]+' </a> ');
				}
				if(absolutePage==this.obj.PageCount)
				{	
					tempText+=('<span style="color:darkgray;">'+_lable[2]+' '+_lable[3]+' </span>');			
				}
				else
				{
					if(parameters!='')
						tempText+=('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'&'+parameters+'">'+_lable[2]+' </a>  <a href="?'+this.options.PageParameterName+'='+(this.obj.PageCount)+'&'+parameters+'">'+_lable[3]+'</a> ');
					else
						tempText+=('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'">'+_lable[2]+'</a> <a href="?'+this.options.PageParameterName+'='+this.obj.PageCount+'">'+_lable[3]+'</a> ');					
				}				
				//详细信息
				if(this.paginationOptions.detail==true)
				{
					tempText+=('页次：'+absolutePage+'/'+this.obj.PageCount+'页 ');
					tempText+=('共'+this.obj.RecordCount+''+this.paginationOptions.unit+''+this.paginationOptions.lab+' ');
					tempText+=(''+this.obj.PageSize+''+this.paginationOptions.unit+''+this.paginationOptions.lab+'/页 ');
					tempText+=('<select name="select" id="select" onchange="jumpMenu(this,\''+parameters+'\');">\n');
						tempText+=('<option value="">转到</option>');
						for(var ipage=1;ipage<=this.obj.PageCount;ipage++)	
						{
							tempText+=('<option value="'+ipage+'">'+ipage+'</option>\n');					
						}
					tempText+=('</select>');
					var js=new JsDoc();
						tempText+=js.begin(true);
							tempText+=('function jumpMenu($selected,$para)');
							tempText+=('{');
							tempText+=('if($para==\'\'||$para==undefined)');
							tempText+=('self.location="?'+this.options.PageParameterName+'="+$selected.value;');
							tempText+=('else');
							tempText+=('self.location="?'+this.options.PageParameterName+'="+$selected.value+"&"+$para;');
							tempText+=('}');
						tempText+=js.end(true);
				}
				
				return tempText;
			},			
			toNumberPagination:function($options)
			{
				//载入设置
				this.setPaginationOptions($options);
				//参数
				var parameters=this.makeParameters();
				//配置分页信息
				var $absolutePage=(this.obj.AbsolutePage-1)<0 ? (this.obj.PageCount):(this.obj.AbsolutePage-1);
				var $start,$end;
				var $first=1,$last=this.obj.PageCount;
				var $pre,$next;	
				//按钮或标签类型数据
				var buttons_chinese=['首页','上一页','下一页','末页','转到'];
				var buttons_mark=[' < ',' << ',' >> ',' > ','Goto'];
				var buttons_number=['<span style="font-family:webdings;">9</span>','<span style="font-family:webdings;">7</span>','<span style="font-family:webdings;">8</span>','<span style="font-family:webdings;">:</span>','Go To'];
				var buttons;
					if(this.paginationOptions.buttons=='chinese')
					{
						buttons=buttons_chinese;	
					}
					else if(this.paginationOptions.buttons=='mark')
					{
						buttons=buttons_mark;		
					}
					else if(this.paginationOptions.buttons=='number')
					{
						buttons=buttons_number;			
					}
					else
					{
						buttons=buttons_number;		
					}
				//计算start,end
					if(this.obj.PageCount<=this.paginationOptions.pageSize)
					{
						$start=1,$end=this.obj.PageCount;	
					}
					else
					{
						if($absolutePage==1)
						{
							$start=1,$end=this.paginationOptions.pageSize;
						}
						else if($absolutePage==this.obj.PageCount)
						{
							$start=(Math.floor(this.obj.PageCount/this.paginationOptions.pageSize)*this.paginationOptions.pageSize)+1;
							$end=this.obj.PageCount;
						}
						else
						{											
							if($absolutePage%this.paginationOptions.pageSize==0)
							{
								$start=(($absolutePage/this.paginationOptions.pageSize-1)*this.paginationOptions.pageSize)+1;
								$end=(($absolutePage/this.paginationOptions.pageSize-1)*this.paginationOptions.pageSize)+this.paginationOptions.pageSize;
							}
							else
							{								
								if($absolutePage/this.paginationOptions.pageSize<1)
								{
									$start=1,$end=this.paginationOptions.pageSize;
								}	
								else
								{
									$start=(Math.floor($absolutePage/this.paginationOptions.pageSize)*this.paginationOptions.pageSize)+1;
									$end=(Math.floor($absolutePage/this.paginationOptions.pageSize)*this.paginationOptions.pageSize)+this.paginationOptions.pageSize;	
								}	
							} 														
						}
						if($start<=0) $start=1
						//-_-!~ 如果不能整除每页显示数，作特殊处理
						if(this.obj.PageCount%this.paginationOptions.pageSize==0)
						{
							if($start>=this.obj.PageCount) $start=(this.obj.PageCount-this.paginationOptions.pageSize)+1
						
						}
						if($end>=this.obj.PageCount) $end=this.obj.PageCount;
						//计算上页与下页的值
						$pre=$absolutePage-1,$next=$absolutePage+1
						if($pre<=0) $pre=1
						if($next>=this.obj.PageCount) $next=this.obj.PageCount;												
						//输出分页
						if($absolutePage==1)
						{
							doc(buttons[0],buttons[1]);	
						}
						else
						{
							if(parameters=='')
							{
								doc('<a href="?'+this.options.PageParameterName+'='+$first+'" title="'+$first+'">'+buttons[0]+'</a>','<a href="?'+this.options.PageParameterName+'='+$pre+'" title="'+$pre+'">'+buttons[1]+'</a>');	
							}
							else
							{
								doc('<a href="?'+this.options.PageParameterName+'='+$first+'&'+parameters+'" title="'+$first+'">'+buttons[0]+'</a>','<a href="?'+this.options.PageParameterName+'='+$pre+'&'+parameters+'" title="'+$pre+'">'+buttons[1]+'</a>');									
							}
						}
							//输出分页码
							for(var ipage=$start;ipage<=$end;ipage++)
							{
								if(parameters=='')
								{
									doc('<a href="?'+this.options.PageParameterName+'='+ipage+'">'+ipage+'</a>','');
								}
								else
								{
									doc('<a href="?'+this.options.PageParameterName+'='+ipage+'&'+parameters+'">'+ipage+'</a>','');	
								}
							}
							//输出分页码
						if($absolutePage==this.obj.PageCount)
						{
							doc(buttons[2],buttons[3]);
						}
						else
						{
							if(parameters=='')
							{
								doc('<a href="?'+this.options.PageParameterName+'='+$next+'" title="'+$next+'">'+buttons[2]+'</a>','<a href="?'+this.options.PageParameterName+'='+$last+'" title="'+$last+'">'+buttons[3]+'</a>');
							}
							else
							{
								doc('<a href="?'+this.options.PageParameterName+'='+$next+'&'+parameters+'" title="'+$next+'">'+buttons[2]+'</a>','<a href="?'+this.options.PageParameterName+'='+$last+'&'+parameters+'" title="'+$last+'">'+buttons[3]+'</a>');
							}
						}
						//详细信息
						if(this.paginationOptions.detail==true)
						{
							doc('&nbsp;&nbsp;&nbsp;');
							doc('<select name="select" id="select" onchange="jumpMenu(this,\''+parameters+'\');">\n');
								doc('<option value="">'+buttons[4]+'</option>');
								for(var ipage=1;ipage<=this.obj.PageCount;ipage++)	
								{
									doc('<option value="'+ipage+'">'+ipage+'</option>\n');					
								}
							doc('</selected>');
							var js=new JsDoc();
								js.begin();
									js.doc('function jumpMenu($selected,$para)');
									js.doc('{');
									js.doc('if($para==\'\'||$para==undefined)');
									js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value;');
									js.doc('else');
									js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value+"&"+$para;');
									js.doc('}');
								js.end();
						}						
					}
			},
			getModule:function()
			{
				//return {title:['a','b'],datetime:['6-25','6-26'],id:['1','2']};
				var fields=this.obj.Fields;			
				var dataObject={};
				
				for(var i=0;i<fields.count;i++){
					dataObject[fields.item(i).name.toLowerCase()]=[];
				}
				
				var tempCounter=this.obj.PageSize;
				var tempFieldValue='';
				while(this.obj.eof==false&&tempCounter>0)
				{
					for(var iField in dataObject)
					{if(iField!='extend'){
						tempFieldValue=this.obj(iField);
						switch(tempFieldValue.Type)
						{
							case adInteger:
							case adCurrency:
								tempFieldValue=Number(tempFieldValue);
								break;	
							case adBoolean:
								tempFieldValue=Boolean(tempFieldValue);
								break;	
							case adDBTimeStamp:
								tempFieldValue=new Date(tempFieldValue);
								tempFieldValue=Dater.format.datetime(tempFieldValue);
								break;	
							case adVarWChar:
								tempFieldValue=String(tempFieldValue);
								break;									
							case adLongVarWChar:
								tempFieldValue=String(tempFieldValue);
								break;								
							default:							
								tempFieldValue=String(tempFieldValue);
						}
						dataObject[iField].push(tempFieldValue);
					}}
					tempCounter--,this.obj.MoveNext();
				}
				
				tempFieldValue=null;
				tempCounter=null;
				return dataObject;
			},
			pageToolbar:function(type,parameters)
			{
				switch(type)
				{
					case 'simple':
						return 'simple'
						break;
					case 'simple1':
						return 'simple1';
						break;
					default:
						return 'default';
				}				
			},			
			close:function()
			{
				if(this.options.RsType=='Page') this.paginationOptions=null;
				this.options=null,this.obj.Close(),this.obj=null;								
				this.c.close();
			}					
		};
/* {@} 数据检索帮助对象--------------------------------------------------------------------------*/
		//数据库映谢对象
		var Database=
			{
				table:
				{
					name:'',				
					field:'Id',		
					type:Number,
					value:'',		
					getData:function()
					{
						try
						{
						//验证数据	
						if(this.type==Number)
						{
							if(isNaN(this.value))
							{
								return false;	
							}
						}
						//构造分句
						var clause=((this.type==Number) ? this.field+'='+this.value : this.field+'=\''+this.value+'\'');
						var tableData=new DataBox('Select * From '+this.name+' Where '+clause+'');
						var tempDataObj=tableData.dataObj;
							tableData.close(),tableData=null;;
							return tempDataObj;
						}
						catch(e)
						{
							if(Configure.Application.state=='Debug')
							{
								echo('DataBase对象执行过程中出错。错误号'+e.number,'错误描述：'+e.description);				
							}
							else
							{
								doc('程序发生意外，请与管理员联系。');	
							}	
							over()
						}
					},
					getFieldValue:function($table,$rField,$field,$value,$type)
					{
						try
						{
							//验证数据	
							if($type==Number)
							{
								if(isNaN($value))
								{
									return false;	
								}
							}	
							//构造分句
							var clause=(($type==Number) ? $field+'='+$value : $field+'=\''+$value+'\'');
							var tableData=new DataBox('Select * From '+$table+' Where '+clause+'');
							var tempDataObjValue=eval('tableData.dataObj.'+$rField+'');
								tableData.close(),tableData=null;
							return tempDataObjValue;				
						}
						catch(e)
						{
							if(Configure.Application.state=='Debug')
							{
								echo('DataBase对象执行过程中出错。错误号'+e.number,'错误描述：'+e.description);				
							}
							else
							{
								doc('程序发生意外，请与管理员联系。');	
							}							
							over();
						}
					}
				},		
				path:function($basePath)
				{
					var pathText='';
					var f=Server.CreateObject('Scripting.FileSystemObject')
						  if(f.FolderExists(Server.MapPath('$_Second_$')))
							  pathText='../';
						  else if(f.FolderExists(Server.MapPath('$_Third_$')))
							  pathText='../../';
						  else if(f.FolderExists(Server.MapPath('$_Fourth_$')))
							  pathText='../../../';	
						  else if(f.FolderExists(Server.MapPath('$_Fifth_$')))
							  pathText='../../../../';	
						  else if(f.FolderExists(Server.MapPath('$_Sixth_$')))
							  pathText='../../../../../';																						
						f=null	
						return pathText+$basePath;
				}
			};
		//数组模拟据集对象
			var ArrayRecordset=Class.create();
				ArrayRecordset.prototype=
				{
					initialize:function($array,$options)
					{
						//己知条件
						this.setOptions($options);
						this.page=this.options.absolutePage,this.AbsolutePage=this.page;									
						this.PageSize=this.options.PageSize;		
						this.RecordCount=parseInt($array.length);
						this.PageCount=this.RecordCount/this.PageSize;				
							if(this.PageCount<1) this.PageCount=1;
							if(this.PageCount.isReal()==true) this.PageCount=Math.floor(this.PageCount)+1;													
						//作规范化处理			
						if(this.page<1) this.page=1;
						if(this.page>this.PageCount) this.page=this.PageCount;					
						//虚拟化数组，数组是从0开始，所以要虚拟化，让程序更清晰
						var LBoundValue=0,UBoundValue=this.RecordCount-1;		
						//算start和end的值								
						var S=0,E=0;				
						switch(this.page)
						{
							case 1:
								//pn "is 1"
								S=LBoundValue,E=(1*this.PageSize)-1;	
								if(this.RecordCount<this.PageSize) E=UBoundValue;					
								break;
							case this.PageCount:
								//pn "is PageCount"
								S=(this.RecordCount-this.PageSize)+1,E=UBoundValue;												
								if(this.RecordCount%this.PageSize==0) S-=1;
								break;
							default:
								//pn "is Else"
								S=((this.page*this.PageSize-this.PageSize)+1)-1,E=(this.page*this.PageSize)-1;						
								if(E>=this.RecordCount) E=UBoundValue;
						}
						//段
						this.start=S,this.destination=E,this.data=$array;		
					},
					setOptions:function($options)
					{
						var PageParameterName;							
							$options=(($options==undefined) ? {}:$options);
							PageParameterName=[$options.PageParameterName==undefined ? 'Page':$options.PageParameterName];
						this.options=
						{
							PageSize:5,
							PageParameterName:PageParameterName,
							absolutePage:((isNaN(Request.QueryString(PageParameterName))||Request.QueryString(PageParameterName)==undefined||Request.QueryString(PageParameterName)=='') ? 1:parseInt(Request.QueryString(PageParameterName))),					
							requestParameters:undefined
						}.extend($options||{});
					},
					setPaginationOptions:function($options)
					{
						this.paginationOptions={
							unit:'条',
							lab:'信息',
							detail:false,
							pageSize:4,
							pageStyle:'numPage1',
							buttons:'chinese',
							parameters:[]
						}.extend($options||{});
					},			
					toStringPagination:function($options)
					{
						if(this.PageCount<=1) return false;
						this.setPaginationOptions($options);
						var parameters=this.makeParameters();	
						var absolutePage=this.page;
						if(absolutePage==1)
						{
							doc('<span style="color:darkgray;">首页 前页 </span>');
						}
						else
						{
							if(parameters!='')
								doc('<a href="?'+this.options.PageParameterName+'=1&'+parameters+'">首页</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'&'+parameters+'">前页</a> ');
							else
								doc('<a href="?'+this.options.PageParameterName+'=1">首页</a> <a href="?'+this.options.PageParameterName+'='+(absolutePage-1)+'">前页 </a> ');
						}
						if(absolutePage==this.PageCount)
						{	
							doc('<span style="color:darkgray;">下页 尾页 </span>');			
						}
						else
						{
							if(parameters!='')
								doc('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'&'+parameters+'">下页 </a>  <a href="?'+this.options.PageParameterName+'='+(this.PageCount)+'&'+parameters+'">尾页</a> ');
							else
								doc('<a href="?'+this.options.PageParameterName+'='+(absolutePage+1)+'">下页</a> <a href="?'+this.options.PageParameterName+'='+this.PageCount+'">尾页</a> ');					
						}				
						//详细信息
						if(this.paginationOptions.detail==true)
						{
							doc('页次：'+absolutePage+'/'+this.PageCount+'页 ');
							doc('共'+this.RecordCount+''+this.paginationOptions.unit+''+this.paginationOptions.lab+' ');
							doc(''+this.PageSize+''+this.paginationOptions.unit+''+this.paginationOptions.lab+'/页 ');
							doc('<select name="select" id="select" onchange="jumpMenu(this,\''+parameters+'\');">\n');
								doc('<option value="">转到</option>');
								for(var ipage=1;ipage<=this.PageCount;ipage++)	
								{
									doc('<option value="'+ipage+'">'+ipage+'</option>\n');					
								}
							doc('</selected>');
							var js=new JsDoc();
								js.begin();
									js.doc('function jumpMenu($selected,$para)');
									js.doc('{');
									js.doc('if($para==\'\'||$para==undefined)');
									js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value;');
									js.doc('else');
									js.doc('self.location="?'+this.options.PageParameterName+'="+$selected.value+"&"+$para;');
									js.doc('}');
								js.end();
						}				
					},		
					makeParameters:function()
					{
						var parameters=[],parameterText='';
						if(this.options.requestParameters!=undefined&&this.options.requestParameters.constructor==Array&&this.options.requestParameters.length>0)
						{					
							
							for(var p=0;p<=this.options.requestParameters.length-1;p++)
							{
								parameters.push(this.options.requestParameters[p]);
							}
						}				
						if(this.paginationOptions.parameters!=undefined&&this.paginationOptions.parameters.constructor==Array&&this.paginationOptions.parameters.length>0)
						{
							for(var p=0;p<=this.paginationOptions.parameters.length-1;p++)
							{
								parameters.push(this.paginationOptions.parameters[p]);
							}
						}	
						for(var p=0;p<=parameters.length-1;p++)
						{
							var tempText=(p==[parameters.length-1]) ? parameters[p]:parameters[p]+'&';
								parameterText+=tempText;
						}	
						return parameterText;	
					},
					close:function()
					{
						this.data=null;
						this.AbsolutePage=null,this.PageCount=null,this.RecordCount=null;
					}				
				};
		//数据处理对象
			var DataHandler=Class.create();
				DataHandler.prototype=
				{
					initialize:function()
					{},
					addData:function($table,$fields,$values)
					{			
						var newId;
						this.isHealth($fields,$values);
						var rs=new Recordset('Select Top 1 * From '+$table+'',{RsType:'Data'});
							rs.obj.AddNew
								var dataCount=0;
								while(dataCount<=$fields.length-1)
								{
									try
									{
										rs.obj($fields[dataCount])=String($values[dataCount]).trim();
										dataCount+=1;							
									}
									catch(e)
									{
										if(Configure.Application.state=='Debug')
										{
											echo('DataHandler执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
										}
										else
										{
											doc('程序发生意外，请与管理员联系。');	
										}
										over();
									}
								}
							rs.obj.Update
							rs.obj.Close();
						//获取新增记录Id号
							rs.obj.Open('SELECT @@IDENTITY AS NewId');
								newId=Number(rs.obj('NewId'));
							rs.close(),rs=null;												
							return newId;
						
					},
					editData:function($sql,$fields,$values)
					{
						this.isHealth($fields,$values);
						var rs=new Recordset($sql,{RsType:'Data'});
								rs.obj.Update
									var dataCount=0;
									while(dataCount<=$fields.length-1)
									{
										try
										{
											rs.obj($fields[dataCount])=String($values[dataCount]).trim();
											dataCount+=1;
										}
										catch(e)
										{
											if(Configure.Application.state=='Debug')
											{
												echo('DataHandler执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
											}
											else
											{
												doc('程序发生意外，请与管理员联系。');	
											}
											over();												
										}
									}							
								rs.obj.Update
							rs.close(),rs=null;
					},
					delData:function($sql)
					{
						var c=new Connection();
							try
							{
								c.obj.Execute($sql);
							}
							catch(e)
							{							
								if(Configure.Application.state=='Debug')
								{
									echo('DataHandler执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
								}
								else
								{
									doc('程序发生意外，请与管理员联系。');	
								}
								over();										
							}
							c.close(),c=null;
					},
					execute:function($sql)
					{
						var connectionObject=new Connection();
							try
							{
								connectionObject.obj.Execute($sql);
							}
							catch(e)
							{
								if(Configure.Application.state=='Debug')
								{
									echo('DataHandler执行过程中出错。错误号：'+e.number,'错误描述：'+e.description);	
								}
								else
								{
									doc('程序发生意外，请与管理员联系。');	
								}
								over();											
							}
							connectionObject.close(),connectionObject=null;
					},
					isHealth:function($fields,$values)
					{		
						try
						{
							if($fields.constructor==Array&&$values.constructor==Array)
							{
								if(!($fields.length==$values.length)) 
								{
									doc('DataHandler对象错误!错误信息:数据模型不对称，请确保fields与values数组大小一致！');
									over();
								}
							}
							else
							{
									doc('DataHandler对象错误!错误信息:数据模型没有通过验证，请检查数据模型是否为合法的数组！')
									over();					
							}
						}
						catch(e)
						{
							doc('DataHandler对象错误!错误信息:数据模型没有通过验证！')
							over();
						}
					},
					close:function()
					{}
				};		
		//数据盒
			var DataBox=Class.create();
				DataBox.prototype=
				{
					initialize:function($sql)
					{
						this.dataObj={};
						this.dataArray=[];			
						this.setDataModel($sql);
					},
					setDataModel:function($sql)
					{
						var rs=new Recordset($sql,{RsType:'Data'})
						if(!rs.obj.eof)
						{
							for(var fcount=0;fcount<=rs.obj.Fields.Count-1;fcount++)  
							{
								eval('this.dataObj.'+rs.obj.Fields(fcount).Name+'=rs.obj.Fields(fcount).Value'); 
								eval('this.dataArray['+fcount+']=rs.obj.Fields(fcount).Value'); 
							}									
						}
						rs.close(),rs=null;
					},
					close:function()
					{
						this.dataObj=null;
						this.dataArray=null;
					}
				};	
/* {@} FSO文件处理对象相关--------------------------------------------------------------------------*/
	var FSO=
		{
			getTextFile:function($path)
			{
				var $f=Server.CreateObject('Scripting.FileSystemObject');
				var $txtFile=$f.OpenTextFile($path,1,true);
				var $txt=$txtFile.ReadAll();
					$txtFile=null,$f=null;
					return $txt;	
			},
			folderExists:function($path)
			{
				var $f=Server.CreateObject('Scripting.FileSystemObject');
				var $folderExistsBool=$f.FolderExists($path);
					$f=null;
				return $folderExistsBool;
			},
			deleteFile:function($path)
			{
				var $f=Server.CreateObject('Scripting.FileSystemObject');
				var isDelete=true;
					try
					{
						$f.DeleteFile(Server.MapPath($path));					
						//doc(Server.MapPath($path))
					}
					catch(e)
					{
						isDelete=false;
					}
					$f=null;
				return isDelete;			
			},
			fileExists:function($path,$object)
			{
				var tempObject=($object!=undefined ? $object:Server.CreateObject('Scripting.FileSystemObject'));
				
				var tempBoolean=tempObject.FileExists($path);
					tempObject=null;
					
				if($object==undefined) tempObject=null;		

				return tempBoolean;
			},
			copyFile:function($source,$destination,$overwrite,$object)
			{
				var tempObject=($object!=undefined ? $object:Server.CreateObject('Scripting.FileSystemObject'));
				
				var tempBoolean=tempObject.CopyFile($source,$destination,$overwrite||false);
					tempObject=null;
					
				if($object==undefined) tempObject=null;		

				return tempBoolean;			
			}
		};	
/* {@} SQL相关---------------------------------------------------------------------------*/	
var SQL=
	{
		injection:function($text)
		{		
			var safeText='\'|\"|^|;|*|%|&|<|>|--|exec|insert|select|delete|update|count|chr|mid|master|truncate|char|declare|fromCharCode|and|or'.split('|');
			try
			{
				for(var injec=0;injec<safeText.length;injec++)
				{
					if(($text.toLowerCase()).indexOf(safeText[injec])!=-1) return true;
				}
				return false;
			}
			catch(e)
			{
				return true;
			}
		},
		illSign:function()
		{
			var safeText='\'|\"|^|;|*|%|&|<|>|--'.split('|');
			try
			{
				for(var injec=0;injec<safeText.length;injec++)
				{
					if(($text.toLowerCase()).indexOf(safeText[injec])!=-1) return true;
				}
				return false;
			}
			catch(e)
			{
				return true;
			}		
		},
		isNumeric:function($id)
		{
			if($id==undefined)
				return false;
			else if($id=='')
				return false;
			else if(isNaN($id))
				return false;
			else
				return true;
		}
	};	
/* {@} 编码辅助对象 CodeHelper--------------------------------------------------------------------------*/
//服务端js输出对象		
	var JsDoc=Class.create();
		JsDoc.prototype=
		{
			initialize:function()
			{},
			doc:function($str)
			{
				Response.Write($str+'\n');
			},
			begin:function($type)
			{
				if($type==true) return '<script language="javascript">\n<!--\n';
				Response.Write('<script language="javascript">\n');
				Response.Write('<!--\n');	
			},
			end:function($type)
			{
				if($type==true) return '\n-->\n</script>';
				Response.Write('-->\n');
				Response.Write('</script>');			
			}
		};	
//服务端Css输出对象		
	var CssDoc=Class.create();
		CssDoc.prototype=
		{
			initialize:function()
			{},
			doc:function($str)
			{
				Response.Write($str+'\n');
			},
			begin:function()
			{
				Response.Write('<style type="text/css">\n');
				Response.Write('<!--\n');
			},
			end:function()
			{
				Response.Write('-->\n');
				Response.Write('</style>');			
			}
		};			
/* {@} Base--------------------------------------------------------------------------*/
//输出
	function doc(str)
	{
		if(arguments.length>1)
		{
			for(var iarguments=0;iarguments<=arguments.length-1;iarguments++)
			{
				doc(arguments[iarguments]+' ');
			}
		}
		else
		{
			Response.Write(''+str+'');
		}
	}
	function echo(str)
	{
		if(arguments.length>1)
		{
			for(var iarguments=0;iarguments<=arguments.length-1;iarguments++)
			{
				echo(arguments[iarguments]);
			}
		}
		else
		{
			Response.Write(''+str+'');
			Response.Write('<br />');
		}
	}	
	function over()
	{
		Response.End()
	}
//取form元素值
	function $(element) {
	  if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
		  elements.push($(String(arguments[i]).trim()));
		return elements;
	  }
	  if (typeof element == 'string')
		element = String((Request.Form(String(element).trim())));
	  return element;
	}
//取url参数
	function $$(element) {
	  if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
		  elements.push(String($(arguments[i])).trim());
		return elements;
	  }
	  if (typeof element == 'string')
		element = String((Request.QueryString(String(element).trim())));
	  return element;
	}	
//取参通用
	function $$$(element) {
	  if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
		  elements.push(String($(arguments[i])).trim());
		return elements;
	  }
	  if (typeof element == 'string')
		element = String(Request(element)).trim();
	  return element;
	}	
//取集合
	function $enum(element)
	{
	  if(arguments.length>1) {
		for (var i=0,elements=[],length=arguments.length;i<length;i++)
		  elements.push($enum(arguments[i]));
		return elements;
	  }
	  element=new Enumerator(Request.Form(element));
	  return element;		
	}	
//Cookies
var Cookies=
	{
		set:function($name,$value)
		{
			Response.Cookies($name)=$value;
		},
		get:function($name)
		{
			return Request.Cookies($name);
		},
		setExpireDate:function($name,$date)
		{
			Response.Cookies($name).Expires=$date;	
		}
	};
//服务器路径
	function sPath($path)
	{
		return Server.MapPath($path);
	}
/*function------------------------------------------------------------------*/	
//工具函数
var Kit={
	makeParameters:function()
	{
		if(arguments.length==0) return undefined;
		var parameters=[],parameterText='';
		if(arguments.length==1)
		{
			if(arguments[0]!=undefined&&arguments[0].constructor==Array&&arguments[0].length>0)
			{
				for(var p=0;p<=arguments[0].length-1;p++)
				{
					parameters.push(arguments[0][p]);
				}
			}		
		}
		else
		{
			for(var argi=0;argi<=arguments.length-1;argi++)
			{
				for(var argj=0;argj<=arguments[argi].length-1;argj++)
				{
					parameters.push(arguments[argi][argj]);
				}
			}
		}
		for(var p=0;p<=parameters.length-1;p++)
		{
			var tempText=(p==[parameters.length-1]) ? parameters[p]:parameters[p]+'&';
				parameterText+=tempText;
		}	
		return parameterText;			
	},
	refresher:function($second)
	{
		var refreshTime=[($second==undefined) ? 10:$second];
		var isRefresh=true;	//'防止刷新时间,单位（秒） 是否使用防刷新功能，0=否，1=是 
		if(isRefresh==true)
		{
			if(Session("RefreshTime")!=undefined&&refreshTime>0)
			{
				if(DateDIff("s", Session("RefreshTime"), Now()) < RefreshTime)
				{
					return true;
				}
				else
				{
					Session("RefreshTime")=Dater.now.datetime();
				}
			}	
			else
			{
				Session("RefreshTime")=Dater.now.datetime();
			}
			return false;
		}
		return false;
	},
	getLocationUrl:function()
	{
		var serverName=Request.ServerVariables("SERVER_NAME");
		var serverPort=Request.ServerVariables("SERVER_PORT");
		var scriptName=Request.ServerVariables("SCRIPT_NAME"); 
		var queryString=Request.ServerVariables("QUERY_STRING"); 
		var locationUrl='http://'+serverName 
		if(serverPort!='80') 
		{
			locationUrl=locationUrl+':'+serverPort 
		}
		locationUrl=locationUrl+scriptName 
		if(queryString!='')
		{
			locationUrl=locationUrl+'?'+queryString 
		}
		return locationUrl;		 	
	}
};
//日期函数
var Dater={
	now:
	{
		date:function($format,$connector)
		{
			return Dater.Format(undefined,1,$format,$connector);			
		},
		datetime:function($format,$connector)
		{
			return Dater.Format(undefined,0,$format,$connector);
		},
		dateOffset:function($offset,$sign,$format,$connector)
		{
			return Dater.Format(undefined,1,$format,$connector,$offset,$sign);
		},
		datetimeOffset:function($offset,$sign,$format,$connector)
		{
			return Dater.Format(undefined,0,$format,$connector,$offset,$sign);
		},
		dateLocale:function($isWeek,$format,$connector)
		{
			return [($isWeek==true) ? Dater.Format(undefined,3,$format,$connector):Dater.Format(undefined,2,$format,$connector)];
		},
		datetimeLocale:function($isWeek,$format,$connector)
		{
			return [($isWeek==true) ? Dater.Format(undefined,5,$format,$connector):Dater.Format(undefined,4,$format,$connector)];
		}	
	},
	format:
	{
		date:function($date,$format,$connector)
		{
			return Dater.Format($date,1,$format,$connector);			
		},
		datetime:function($datetime,$format,$connector)
		{
			return Dater.Format($datetime,0,$format,$connector);
		},
		dateOffset:function($date,$offset,$sign,$format,$connector)
		{
			return Dater.Format($date,1,$format,$connector,$offset,$sign);
		},
		datetimeOffset:function($date,$offset,$sign,$format,$connector)
		{
			return Dater.Format($date,0,$format,$connector,$offset,$sign);
		},
		dateLocale:function($date,$isWeek,$format,$connector)
		{
			return [($isWeek==true) ? Dater.Format($date,3,null,null):Dater.Format(undefined,2,null,null)];
		},
		datetimeLocale:function($datetime,$isWeek,$format,$connector)
		{
			return [($isWeek==true) ? Dater.Format($datetime,5,$format,$connector):Dater.Format($datetime,4,$format,$connector)];
		}					
	},
	Format:function($dateTime,$style,$format,$connector,$offset,$sign)
	{
		var dateObj;
			switch(typeof($dateTime))
			{
				case 'undefined':
					dateObj=new Date();	
					break;
				case 'string':
					if(/\w{3}\s{1}\w{3}\s{1}\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}\s{1}UTC\+\d{4}\s{1}\d{4}/gi.test($dateTime))
					{
						dateObj=new Date(Object($dateTime))
					}
					else if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($dateTime)||/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($dateTime))
					{
						if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($dateTime))
						{
							dateObj=new Date($dateTime.split('-')[0],Number($dateTime.split('-')[1])-0,$dateTime.split('-')[2]);
						}
						if(/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($dateTime))
						{
							var dateArray=$dateTime.split(' ');
							var date0=dateArray[0].split('-'),date1=dateArray[1].split(':');
							dateObj=new Date(date0[0],Number(date0[1])-0,date0[2],date1[0],date1[1],date1[2]);
						}
					}
					else
						dateObj=new Date();
					break;
				case 'object':
					dateObj=new Date($dateTime);
					break;
				default:
					dateObj=new Date();	
			}			
		var weekDay=dateObj.getDay();
		var $connector=($connector==undefined) ? '-':$connector;
		var $sign=($sign==undefined) ? '+':'-';
		var $format=($format==undefined) ? 0:$format;
			if($offset!=undefined||Number($offset)>0) dateObj.setDate([($sign=='+') ? dateObj.getDate()+Number($offset):dateObj.getDate()-Number($offset)]);
			switch(weekDay)
			{
				case 0:
					weekDay="星期日";
					break;
				case 1:
					weekDay="星期一"
					break;
				case 2:
					weekDay="星期二"
					break;
				case 3:
					weekDay="星期三"
					break;
				case 4:
					weekDay="星期四"
					break;
				case 5:
					weekDay="星期五"
					break;
				case 6:
					weekDay="星期六"
			}					
			switch($style)
			{
				case 0:		//datetime
					switch($format)
					{
						case 0:		//ymd hms
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break;
						case 1: 	//mdy hms
							return (dateObj.getMonth()+1)+$connector+dateObj.getDate()+$connector+dateObj.getFullYear()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break; 
						case 2:		//dmy hms
							return dateObj.getDate()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getFullYear()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break;
						default:
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
					}	
					break;			
				case 1:		//date
					switch($format)
					{
						case 0:		//ymd hms
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate();
							break;
						case 1:		//mdy hms
							return (dateObj.getMonth()+1)+$connector+dateObj.getDate()+$connector+dateObj.getFullYear();
							break; 
						case 2:		//dmy hms
							return dateObj.getDate()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getFullYear(); 
							break;
						default:
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate();
					}
					break;
				case 2: 	//cn1
					return dateObj.getFullYear()+'年'+(dateObj.getMonth()+1)+'月'+dateObj.getDate()+'日';
					break;
				case 3: 	//cn2
					return dateObj.getFullYear()+'年'+(dateObj.getMonth()+1)+'月'+dateObj.getDate()+'日 '+weekDay;
					break;
				case 4: 	//cn3
					return dateObj.getFullYear()+'年'+(dateObj.getMonth()+1)+'月'+dateObj.getDate()+'日 '+dateObj.getHours()+'点'+dateObj.getMinutes()+'分';	
					break;
				case 5: 	//cn4
					return dateObj.getFullYear()+'年'+(dateObj.getMonth()+1)+'月'+dateObj.getDate()+'日 '+dateObj.getHours()+'点'+dateObj.getMinutes()+'分 '+weekDay;					
					break;
				default:	//datetime 	
					switch($format)
					{
						case 0:		//ymd hms
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break;
						case 1: 	//mdy hms
							return (dateObj.getMonth()+1)+$connector+dateObj.getDate()+$connector+dateObj.getFullYear()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break; 
						case 2:		//dmy hms
							return dateObj.getDate()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getFullYear()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
							break;
						default:
							return dateObj.getFullYear()+$connector+(dateObj.getMonth()+1)+$connector+dateObj.getDate()+' '+dateObj.getHours()+':'+dateObj.getMinutes()+':'+dateObj.getSeconds();
					}
			}		
	},
	diff:function($d0,$d1,$type)
	{
		var date0Obj,date1Obj;
			switch(typeof($d0))
			{
				case 'undefined':
					date0Obj=new Date();	
					break;
				case 'string':
					if(/\w{3}\s{1}\w{3}\s{1}\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}\s{1}UTC\+\d{4}\s{1}\d{4}/gi.test($d0))
					{
						date0Obj=new Date(Object($d0))
					}
					else if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($d0)||/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($d0))
					{
						if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($d0))
						{
							date0Obj=new Date($d0.split('-')[0],Number($d0.split('-')[1])-0,$d0.split('-')[2]);
						}
						if(/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($d0))
						{
							var dateArray=$d0.split(' ');
							var date0=dateArray[0].split('-'),date1=dateArray[1].split(':');
							date0Obj=new Date(date0[0],Number(date0[1])-0,date0[2],date1[0],date1[1],date1[2]);
						}
					}
					else
						date0Obj=new Date();
					break;
				case 'object':
					date0Obj=new Date($d0);	
					break;
				default:
					date0Obj=new Date();	
			}
			switch(typeof($d1))
			{
				case 'undefined':
					date1Obj=new Date();	
					break;
				case 'string':
					if(/\w{3}\s{1}\w{3}\s{1}\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}\s{1}UTC\+\d{4}\s{1}\d{4}/gi.test($d1))
					{
						date1Obj=new Date(Object($d1))
					}
					else if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($d1)||/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($d1))
					{
						if(/\d{4}\-\d{1,2}\-\d{1,2}/gi.test($d1))
						{
							date1Obj=new Date($d1.split('-')[0],Number($d1.split('-')[1])-0,$d1.split('-')[2]);
						}
						if(/\d{4}\-\d{1,2}\-\d{1,2}\s{1}\d{1,2}:\d{1,2}:\d{1,2}/gi.test($d1))
						{
							var dateArray=$d1.split(' ');
							var date0=dateArray[0].split('-'),date1=dateArray[1].split(':');
							date1Obj=new Date(date0[0],Number(date0[1])-0,date0[2],date1[0],date1[1],date1[2]);
						}
					}
					else
						date1Obj=new Date();
					break;
				case 'object':
					date1Obj=new Date($d1);	
					break;
				default:
					date1Obj=new Date();	
			}		
			switch($type)
			{
				case 'y': 	//年
					return Math.floor((date0Obj-date1Obj)/1000/60/60/24/365)<0 ? 1:Math.floor((date0Obj-date1Obj)/1000/60/60/24/365);
					break;
				case 'q': 	//年
					return Math.floor((date0Obj-date1Obj)/1000/60/60/24/365)<0 ? 1:Math.floor((date0Obj-date1Obj)/1000/60/60/24/90);
					break;					
				case 'm':	//月
					return Math.floor((date0Obj-date1Obj)/1000/60/60/24/30)<0 ? 1:Math.floor((date0Obj-date1Obj)/1000/60/60/24/30);
					break;
				case 'w':	//周
					return Math.floor((date0Obj-date1Obj)/1000/60/60/24/7)<0 ? 1:Math.floor((date0Obj-date1Obj)/1000/60/60/24/7);
					break;
				case 'd': 	//日 
					return (date0Obj-date1Obj)/1000/60/60/24;
					break;									
				case 'h': 	//时
					return (date0Obj-date1Obj)/1000/60/60;
					break;
				case 'mm': 	//分
					return (date0Obj-date1Obj)/1000/60;
					break;
				case 's': 	//秒
					return (date0Obj-date1Obj)/1000;
					break;	
				case 'ms': 	//毫秒	
					return date0Obj-date1Obj;													
					break;
				default:	//日
					return Math.abs(Math.floor((date0Obj-date1Obj)/1000/60/60/24));
			}			
	},
	formatCountdown:function($value)
	{
		if($value<=0)
		{
			return '--:--:--';	
		}
		var $seconds=parseInt($value/1000);	
		var $d=Math.floor($seconds/Unit.time.toSeconds.day);
		var $h=Math.floor(($seconds-$d*Unit.time.toSeconds.day)/Unit.time.toSeconds.hour);
		var $m=Math.floor(($seconds-$d*Unit.time.toSeconds.day-$h*Unit.time.toSeconds.hour)/Unit.time.toSeconds.minute);
		var $s=Math.floor($seconds-$d*Unit.time.toSeconds.day-$h*Unit.time.toSeconds.hour-$m*Unit.time.toSeconds.minute);
		//将天数折成小时
		if($d!=0) $h=parseInt($seconds/Unit.time.toSeconds.day*24);
		return $h.toDateText()+':'+$m.toDateText()+':'+$s.toDateText()+'';
	}
};
//转向函数
	var Guide={
		goUrl:function($url,$str,$method,$second)
		{
			var second=($second) ? (!isNaN($second) ? $second:2000):2000;
			var j=new JsDoc();
			if($method=='nojs'||$method=='noa'||$method=='noalert'||$method=='no'||$method=='none'||$method=='nothing')
			{
				
				Response.Write($str);
				j.begin();
					j.doc('if(top!=self)');
					j.doc('setTimeout(function(){top.location="'+$url+'";},'+second+');');
					j.doc('else');
					j.doc('setTimeout(function(){self.location="'+$url+'";},'+second+');');
				j.end();						
			}
			else
			{
				j.begin();
					j.doc('alert("'+$str+'")');
					j.doc('if(top!=self)');
					j.doc('top.location="'+$url+'";');
					j.doc('else');
					j.doc('self.location="'+$url+'";');
				j.end();
			}
			var j=null;
		},
		rUrl:function($url,$str,$second) 
		{
			var second=(($second) ? $second:2);
			if($str) doc($str);
			doc('<meta http-equiv="refresh" content="'+second+';URL='+$url+'">');
		},
		tUrl:function($url) 
		{
			Response.Redirect($url);
		},
		hUrl:function($str,$method,$second) 
		{
			var $ms=($second==undefined ? 2000:$second);
			var j=new JsDoc();
			if($method=='a'||$method=='alert'||$method=='js')
			{
				
				j.begin();
					j.doc('alert("'+$str+'")');
					j.doc('location.href="javascript:history.go(-1);"');
				j.end();			
			}		
			else
			{
				Response.Write($str);
				j.begin();
					j.doc('setTimeout(function(){location.href="javascript:history.go(-1)";},'+$ms+');');
				j.end();
			}
			var j=null;
		},
		cUrl:function($str,$lable,$url,$title,$special)
			{
				if($lable==undefined){
					$lable='返回';
				}
				if($url==undefined){
					$url='javascript:history.go(-1);';
				}
				doc($str);
				var $msg='<a href="'+$url+'">'+$lable+'</a>';
				Response.Write($msg);
			}		
	};
/* {@} Debug--------------------------------------------------------------------------*/
var Debug=
	{
		alert:function(str)
		{
			if(arguments.length>1)
			{
				for(var iarguments=0;iarguments<=arguments.length-1;iarguments++)
				{
					echo(arguments[iarguments]);
				}
			}
			else
			{
				doc(''+str+'');				
			}
			over();
		}
	};	
/* {@} web安全相关对象--------------------------------------------------------------------------*/	
	var Safe=
	{
		//MD5加密
		MD5:function($sMessage)
		{
		   function RotateLeft(lValue, iShiftBits)
		   {
			 return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
		   }
		
		   function AddUnsigned(lX,lY)
		   {
			 var lX4,lY4,lX8,lY8,lResult;
			 lX8 = (lX & 0x80000000);
			 lY8 = (lY & 0x80000000);
			 lX4 = (lX & 0x40000000);
			 lY4 = (lY & 0x40000000);
			 lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
			 if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
			 if (lX4 | lY4) {
				 if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
				 else return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
			   } else return (lResult ^ lX8 ^ lY8);
		   }
		  
		   function F(x,y,z) { return (x & y) | ((~x) & z); }
		
		   function G(x,y,z) { return (x & z) | (y & (~z)); }
		
		   function H(x,y,z) { return (x ^ y ^ z); }
		  
		   function I(x,y,z) { return (y ^ (x | (~z))); }
		  
		   function FF(a,b,c,d,x,s,ac) {
			 a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
			 return AddUnsigned(RotateLeft(a, s), b);
		   }
		
		   function GG(a,b,c,d,x,s,ac) {
			 a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
			 return AddUnsigned(RotateLeft(a, s), b);
		   }
		
		   function HH(a,b,c,d,x,s,ac) {
			 a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
			 return AddUnsigned(RotateLeft(a, s), b);
		   }
		
		   function II(a,b,c,d,x,s,ac) {
			 a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
			 return AddUnsigned(RotateLeft(a, s), b);
		   }
		
		   function ConvertToWordArray($sMessage) {
			 var lWordCount;
			 var lMessageLength = $sMessage.length;
			 var lNumberOfWords_temp1=lMessageLength + 8;
			 var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
			 var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
			 var lWordArray=Array(lNumberOfWords-1);
			 var lBytePosition = 0;
			 var lByteCount = 0;
			 while ( lByteCount < lMessageLength ) {
			   lWordCount = (lByteCount-(lByteCount % 4))/4;
			   lBytePosition = (lByteCount % 4)*8;
			   lWordArray[lWordCount] = (lWordArray[lWordCount] | ($sMessage.charCodeAt(lByteCount)<<lBytePosition));
			   lByteCount++;
			 }
			 lWordCount = (lByteCount-(lByteCount % 4))/4;
			 lBytePosition = (lByteCount % 4)*8;
			 lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
			 lWordArray[lNumberOfWords-2] = lMessageLength<<3;
			 lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
			 return lWordArray;
		   }
		
		   function WordToHex(lValue) {
			 var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
			 for (lCount = 0;lCount<=3;lCount++) {
			   lByte = (lValue>>>(lCount*8)) & 255;
			   WordToHexValue_temp = "0" + lByte.toString(16);
			   WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
			 }
			 return WordToHexValue;
		   }
		
		   var x=Array();
		   var k,AA,BB,CC,DD,a,b,c,d
		   var S11=7, S12=12, S13=17, S14=22;
		   var S21=5, S22=9 , S23=14, S24=20;
		   var S31=4, S32=11, S33=16, S34=23;
		   var S41=6, S42=10, S43=15, S44=21;
		   // Steps 1 and 2. Append padding bits and length and convert to words
		   x = ConvertToWordArray($sMessage);
		   // Step 3. Initialise
		   a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
		   // Step 4. Process the message in 16-word blocks
		   for (k=0;k<x.length;k+=16) {
			 AA=a; BB=b; CC=c; DD=d;
			 a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
			 d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
			 c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
			 b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
			 a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
			 d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
			 c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
			 b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
			 a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
			 d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
			 c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
			 b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
			 a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
			 d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
			 c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
			 b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
			 a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
			 d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
			 c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
			 b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
			 a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
			 d=GG(d,a,b,c,x[k+10],S22,0x2441453);
			 c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
			 b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
			 a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
			 d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
			 c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
			 b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
			 a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
			 d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
			 c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
			 b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
			 a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
			 d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
			 c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
			 b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
			 a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
			 d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
			 c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
			 b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
			 a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
			 d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
			 c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
			 b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
			 a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
			 d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
			 c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
			 b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
			 a=II(a,b,c,d,x[k+0], S41,0xF4292244);
			 d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
			 c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
			 b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
			 a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
			 d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
			 c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
			 b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
			 a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
			 d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
			 c=II(c,d,a,b,x[k+6], S43,0xA3014314);
			 b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
			 a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
			 d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
			 c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
			 b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
			 a=AddUnsigned(a,AA); b=AddUnsigned(b,BB); c=AddUnsigned(c,CC); d=AddUnsigned(d,DD);
		   }
		   // Step 5. Output the 128 bit digest
		   var temp= WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
		   return temp.toLowerCase();
		},		
		//检测浏览器是否支持cookies
		cookies_Do:function()
		{
			var $cookies_Do=true;
			Response.Cookies('cookies_Do')='cookiesDo';
			if(Request.Cookies('cookies_Do')!='cookiesDo')
			{
				$cookies_Do=false;				
			}	
			Response.Cookies('cookies_Do')='';
			return $cookies_Do;
		},
		//检测浏览器是否支持js
		javascript_Do:function($isJsOkValue)
		{
			var isJsOkValue=((isNaN($isJsOkValue)||parseInt($isJsOkValue)<1) ? 0:1);
			var $isJs=true;				
				if(Boolean(isJsOkValue)==false) $isJs=false;
			return $isJs;			
		},
		//检测浏览器是否支持js与cookies
		javascript_cookies_Do:function($isJsOkValue)
		{		
			var $isCookies=true;
				Response.Cookies('cookies_Do')='cookiesDo';
				if(Request.Cookies('cookies_Do')!='cookiesDo')	$isCookies=false;
			var isJsOkValue=((isNaN($isJsOkValue)||parseInt($isJsOkValue)<1) ? 0:1);
			var $isJs=true;						
				if(Boolean(isJsOkValue)==false) $isJs=false;
			return ($isJs==true&&$isCookies==true);				
		},
		//检测重复提交 
		preventRepeatSubmit:function($formCode,$sessionCodeName)
		{
			//按钮变灰 客户端实现
			//验证码   服务端实现 0:重复提交,1:验证码不正确,2:正确
			 if(Session($sessionCodeName)==''||Session($sessionCodeName)==undefined)
			 {
			 	return 0;
			 }
			 else
			 {
			 	if($formCode!=Session($sessionCodeName))
				{
					return 1;
				}
				else
				{
					Session($sessionCodeName)=null;
					return 2;
				}
			 }
		},
		//检测来源
		sourceInspect:function()
		{
			var server_v1=String(Request.ServerVariables("HTTP_REFERER")).toLowerCase();
			var server_v2=String(Request.ServerVariables("SERVER_NAME")).toLowerCase();
			return (server_v1.substr(7,server_v2.length)==server_v2);		
		},	
		//创建验证码
		createValCode_iframe:function($id,$src,$isHaveChangeStr,$width,$height)
		{
			var $$id=(($id==undefined) ? 'valCode':$id);
			//var $$formWidgetName=(($formWidgetName==undefined) ? 'valCodeValue':$formWidgetName);
			var $$width=(($width==undefined) ? 62:$width);
			var $$height=(($height==undefined) ? 23:$height);
			var $$isHaveChangeStr=$isHaveChangeStr;
			doc('<iframe id="'+$$id+'" name="'+$$id+'" frameborder="0" marginheight="0" marginwidth="0" width="'+$$width+'" height="'+$$height+'" src="'+$src+'" scrolling="no"></iframe>');		
			//Debug.alert($$isHaveChangeStr)
			if($$isHaveChangeStr==true) 
			{
				doc('<a style="cursor:pointer;font-size:12px;padding:5px;valign:middle;" onclick="changeValCode(\''+$$id+'\',\''+$src+'\')">看不清?换一张!</a>');
			}
			var valJs=new JsDoc();
				valJs.begin();
					valJs.doc('function changeValCode($id,$url){document.getElementById($id).src=$url;}');
				valJs.end();
		},
		createValCode_image:function($id,$src,$isHaveChangeStr,$width,$height)
		{
			var $$width=(($width==undefined) ? 62:$width);
			var $$height=(($height==undefined) ? 23:$height);
			var isHaveChangeStr=(($isHaveChangeStr==undefined) ? true:$isHaveChangeStr);
			doc('<img src="'+$src+'" width="'+$$width+'" height="'+$$height+'" alt="" id="'+$id+'" name="'+$id+'" />');		
			if(isHaveChangeStr==true) doc('<a style="cursor:pointer;font-size:12px;padding:5px;valign:middle;" onclick="changeImage(\''+$id+'\',\''+$src+'\')">看不清?换一张!</a>');
			var valJs=new JsDoc();
				valJs.begin();
					valJs.doc('function changeImage($id,$url){document.getElementById($id).src=$url+\'?hack=\'+String((99-2)*Math.random()+1);}');
				valJs.end();					
		},
		createValCode_text:function($name)
		{
			Session($name)=String(parseInt((Math.random()*(10-2))+1))+String(parseInt((Math.random()*(10-2))+1))+String(parseInt((Math.random()*(10-2))+1))+String(parseInt((Math.random()*(10-2))+1));
			return Session($name);
		},		
		//生成管理者登录或操作加密信息时所用的公钥
		rndKey:function($md5)
		{
			var key_0=String(parseInt((9-1)*Math.random()+1));
			var key_1=String.fromCharCode(parseInt((90-(65+1))*Math.random()+65));
			var key_2=String(parseInt((9-1)*Math.random()+1));
			var key_3=String.fromCharCode(parseInt((90-(65+1))*Math.random()+65));
			var key_4=String(parseInt((9-1)*Math.random()+1));
			var key_5=String.fromCharCode(parseInt((90-(65+1))*Math.random()+65));
			var $$key=key_0+key_1+key_2+key_3+key_4+key_5;
				if($md5==true) $$key=Safe.MD5($$key);
			return $$key;
		}		
	};
/* {@} 常用正则表达式对象--------------------------------------------------------------------------*/	
var Regexper=
	{
		date:/^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/,	
		httpUrl:new RegExp('[a-zA-z]+://[^\s]+','i'),														//url
		idcard:/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/,									//身份证
		email:/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,												//email地址
		url:new RegExp("^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$"),							//url地址
		mobile:/(^1{1}(3|5|8){1}[0-9]{1}\d{8}$)/,													//手机号码
		phone:/^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/,										//电话 传真
		zipCode:/^[a-zA-Z0-9]{3,12}$/, 																//邮政编码
		chineseChar:/[u4e00-u9fa5]/,																//匹配中文字符
		doubleChar:/[^x00-xff]/,																	//匹配双字节字符
		float:/^(-?\\d+)(\\.\\d+)?$/,																//浮点数
		pFloat:/^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$/,						//正浮点数
		npFloat:/^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$/,													//非正浮点数
		nFloat:/^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/,						//负浮点数
		Abc:/^[A-Za-z]+$/,　　																	//由26个英文字母组成的字符串 
		ABC:/^[A-Z]+$/,　																		//由26个英文字母的大写组成的字符串 
		abc:/^[a-z]+$/,　																		//由26个英文字母的小写组成的字符串 
		sString0:/^[A-Za-z0-9]+$/,　　																//由数字和26个英文字母组成的字符串
		sString1:/^\\w+$/　　																	//由数字、26个英文字母或者下划线组成的字符串  		
	};
/* {@} 网络通信对象---------------------------------------------------------------------------*/	
var JMail=
	{
		serverUserName:'7627-8@163.com',			//输入smtp服务器验证登陆名
		serverPassword:'wygl153767',				//输入smtp服务器验证密码 
		from:'7627-8@163.com',					//发件人
		fromName:'小密蜂 JS/ASP FrameWork',		//发件人姓名
		recipient:'daniel-jusa@hotmail.com',			//收件人
		subject:'欢迎完善',						//主题
		body:'无',								//正文 
		priority:1,								//设定邮件优先级1为紧急，3为正常，5为缓慢
		smtpServer:'smtp.163.com',				//邮件服务器						
		charSet:'gb2132',
		send:function()
		{
			try
			{
				var JMsg=Server.CreateObject("Jmail.Message");
					JMsg.silent=true; 
					JMsg.Logging=true; 
					JMsg.Charset=this.charSet;
					JMsg.ISOEncodeHeaders=false;				//是否进行ISO编码 
					JMsg.ContentType='Text/Html';				//邮件类型
					JMsg.MailServerUserName=this.serverUserName;     	
					JMsg.MailServerPassword=this.serverPassword;		
					JMsg.From=this.from;                   
					JMsg.FromName=this.fromName;                  
					JMsg.AddRecipient(this.recipient);        
					JMsg.Subject=this.subject;                     
					JMsg.Body=this.body;                   
					JMsg.Priority=this.priority;                      
					JMsg.SEnd(this.smtpServer);                 
					JMsg=null; 
				return true;	
			}
			catch(e)
			{
				return false;
			}
		}
	};
/* {@} HTML辅助对象---------------------------------------------------------------------------*/	
var Document=
	{
		form:
		{			
			isCheckbox:function($factor,$value)	//复选框预定值
			{
				if(String($value)==String($factor)) 
					return 'checked="checked"';				
			},			
			isRadio:function($factor,$value)	//单选框预定值
			{
				if(String($value)==String($factor)) 
					return 'checked="checked"';				
			},
			isNull:function($value)
			{
				if($value==''||$value=='undefined'||$value==undefined){
					return true;
				}
				return false;
			}
		}
	};
/* {@} 文件上传对象---------------------------------------------------------------------------*/	
var UpLoadClass=Class.create();
	UpLoadClass.prototype=
	{
		/* 构造函数 */
		initialize:function($options)
		{
			this.unit={kb:1024,mb:1024<<10,gb:1024<<20};
			this.setOptions($options);							//配置参数,为空使用默认参数				
			this.formData={},this.fileCdatalog={};					//表单数据及文件数据日志												
			this.stream=Server.CreateObject('ADODB.Stream');		//二进制数据存储对象
			this.temp=Server.CreateObject('ADODB.Stream');		//临时转换器
			this.stream.type=1;
			this.stream.Open();												
			this.error=0,this.description='';				
			this.count=0,this.log={};
			this.mode='standard';								//debug||standard
		},
		/* 参数设置 */
		setOptions:function($options)
		{								
			this.options={					
				charSet:'utf-8',							 //转换文本编码
				autoSave:false,						//自动存取	
				maxSize:200*this.unit.kb,				//文件大小200k
				totalSize:10*this.unit.mb,				 //限制数据量
				path:'../../../UpLoadFiles/',				 //文件上传路径							
				type:'gif/jpg/jpeg'						 //上传文件类型
			};
			if($options!=undefined) Object.extend(this.options,$options);
		},
		reSetOptions:function($options)					
		{
			if($options!=undefined) Object.extend(this.options,$options);
		},
		/*　辅助方法:检查状态　*/
		state:function()
		{
			//-1:不是POST请求 0:表单entype设置不对 1:表单上传的数据大小超总限制 2:正常
			if(Request.ServerVariables('REQUEST_METHOD')=='POST')
			{
				var contentType=new String(Request.ServerVariables('CONTENT_TYPE'));
				if(contentType.indexOf('multipart/form-data')==-1) 
				{									
					return 0;
				}
				else
				{
					
					if(Request.TotalBytes>=this.options.totalSize)
					{
						return 1;
					}
					else
					{
						return 2;
					}
				}					
			}	
			else
			{
				return -1;
			}
		},
		/* 打开对象 */																					
		open:function()
		{
			switch(this.state())
			{
				case -1:
					this.throwError(7);
					break;						
				case 0:					
					this.throwError(1);
					break;
				case 1:
					this.throwError(6);
					break;
				case 2:
					var data=this.data(),limit=this.limit(data);						
					this.spider(data,limit);
					break;					
				default:
					this.throwError(9999);		
			}
		},
		/* 返回表单控件值 */	
		form:function($name)
		{
			if(this.error!=-1) return this.formData[$name];
		},
		/* 存取文件域中的文件 手动的方法 */			
		save:function($elementName)
		{
			if(this.options.autoSave) return false;									//自动存取为真禁止调用此方法
			if(this.fileCdatalog[$elementName])			
			{
				if(this.fileCdatalog[$elementName].fileSize>this.options.maxSize){		//验证文件大小  
					this.throwError(3);
					this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};
					return false;				
				} 
				if(!this.isFileExt(this.fileCdatalog[$elementName].fileExt)){				//验证文件扩展名
					this.throwError(4);
					this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};
					return false;				
				}
				this.folderObserver();
				var fileName=this.makeFileName(this.fileCdatalog[$elementName].fileExt);					
				var file=this.options.path+fileName,file=Server.MapPath(file);
					this.formData[$elementName].file=fileName;
				//开始干活
				this.temp.type=1,this.temp.open();									
				this.stream.position=this.fileCdatalog[$elementName].fileBinaryStartPosition;
				this.stream.copyTo(this.temp,this.fileCdatalog[$elementName].fileSize);
				this.temp.saveToFile(file,2);
				this.temp.close();		
				//写上传日志
				this.log[$elementName]={name:$elementName,name:$elementName,isUpload:true,error:0,description:''};
				return true;				
			}
			else
			{
				//没有检测到此文本域，不做任何操作
				//写日志，读取组件错误状态
				this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};
				return false;				
			}
		},
		/* 当autoSave设置为true时自动存取表单中的文件 */	
		saveToFile:function($elementName,$position,$length,$ext,$size)
		{
			if(!($position==undefined||!$position.constructor==Number)||($length==undefined||!$length.constructor==Number))
			{
				if($size>this.options.maxSize){											//验证文件大小  
					this.throwError(3);
					this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};
					return false;
				} 
				if(!this.isFileExt($ext)){												//验证文件扩展名
					this.throwError(4);
					this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};
					return false;
				}
				this.folderObserver();			
				var fileName=this.makeFileName(this.fileCdatalog[$elementName].fileExt);			
				var file=this.options.path+fileName,file=Server.MapPath(file);
					this.formData[$elementName].file=fileName;
				this.temp.type=1,this.temp.open();									
				this.stream.position=$position;
				this.stream.copyTo(this.temp,$length);
				this.temp.saveToFile(file,2);
				this.temp.close();
				this.log[$elementName]={name:$elementName,name:$elementName,isUpload:true,error:0,description:''};
				return true;	
			}
			else
			{
				//抛出错误
				this.throwError(5);
				//写日志，读取组件错误状态
				this.log[$elementName]={name:$elementName,isUpload:false,error:this.error,description:this.description};				
				return false;
			}
		},	
		/* 爬行二进制数据流,生成表单数据，并记录文件日志 */				
		spider:function($data,$limit)
		{
			var start,finish,position3;
			var formElementName,filePath,fileName,fileExt,fileSize;
			start=$data.indexOf($limit);
			while(start!=-1)						
			{				
				//查找位置
				start+=$limit.length+2,finish=$data.indexOf($limit,start);				
				if(finish==-1) break;
				
				position3=$data.indexOf("\r\n\r\n",start);								//寻找报头的结束位置
				if(position3==-1||position3>finish) break;
				position3+=4;
				
				var head=this.toText(start,position3-start);							//获取报头字符串									
					if((formElementName=head.match(/\sname=\"(.+?)\"/))==null) break;	//寻找name属性位置
					formElementName=formElementName[1];					
					if(head.indexOf('filename')!=-1) 
					{						
							this.log[formElementName]={isUpload:false,error:0,description:''};							
					}
				var fileName=head.match(/\sfilename=\"(.+?)\"/);						//寻找filename属性位置
				if(fileName)															//找到filename属性
				{						
					fileName=fileName[1];									
					fileExt=fileName.match(/\.(\w+)$/),fileExt=fileExt[1].toLowerCase();						
					fileSize=finish-position3-4;
					//文件的相关操作
					var fileInfo=this.getFileInfo(position3,fileSize),imageWidth,imageHeight;							
					if(this.isImage(fileExt)==true)
					{
						if(fileInfo.isImage==true) 
						{	
							imageWidth=fileInfo.width;
							imageHeight=fileInfo.height;
							fileExt=fileInfo.ext;
						}
						else
						{
							this.throwError(4);
							return false;
						}
					}
					//记录文件日志与表单日志
					this.makeCdatalog({
										formElementName:formElementName,
										fileName:fileName,
										fileExt:fileExt,
										fileSize:fileSize,
										fileBinaryStartPosition:position3,
										width:((imageWidth) ? imageWidth:null),
										height:((imageHeight) ? imageHeight:null)
										});
					this.makeFormData('file',{
										name:formElementName,
										file:fileName,
										ext:fileExt,
										size:fileSize,
										width:((imageWidth) ? imageWidth:null),	
										height:((imageHeight) ? imageHeight:null)											
										});							
					//存储文件信息
					if(this.options.autoSave==true){

						this.saveToFile(formElementName,position3,finish-position3-4,fileExt,fileSize);										
					};
				}
				else
				{							
					this.makeFormData('form',{
										name:formElementName,
										position:position3,
										length:finish-position3-4
										});					
				}
				start=finish;															
			}
		},			
		/* 生成表单数据 */
		makeFormData:function($type,$data)											//制作表单数据模型
		{
			//$position,$length,$name
			if($type=='form')
			{
				var formElementValue=this.toText($data.position,$data.length);												
					this.formData[$data.name]=formElementValue;
			}
			else
			{
				var fileInfo={file:$data.file,ext:$data.ext,size:$data.size,width:$data.width,height:$data.height}
					this.formData[$data.name]=fileInfo;
			}					
		},	
		/* 生成文件日志 */
		makeCdatalog:function($fileInfo)											//制作文件数据模型
		{																
			this.fileCdatalog[$fileInfo.formElementName]=$fileInfo;					
		},
		/* 表单数据 */															
		data:function()
		{
			var kb=1024,chunk=kb*200,formData;
			var size=Request.TotalBytes;
			while(size>chunk)
			{
				this.stream.write(Request.BinaryRead(chunk));
				size-=chunk;
			}
			if(size>0) this.stream.write(Request.BinaryRead(size));
			this.stream.position=0,this.stream.type=2;
			this.stream.charset="ascii";
			if(!this.stream.EOS) var formData=this.stream.readText(-1); 
			this.stream.position=0,this.stream.type=1;
			return formData;
		},	
		/* 分隔符 */				
		limit:function($data)
		{
			var start=$data.indexOf("--");
			start+=2;				
			var end=$data.indexOf("\r\n",start);
			return $data.substring(start,end);
		},
		/* 生成文件名 */			
		makeFileName:function($ext)
		{
			var myDateObj=new Date();
			var myYear,myMonth,myDate,myDay,myHours,myMinutes,mySeconds;
				myYear=(myDateObj.getYear()).toString();
				myMonth=(myDateObj.getMonth()+1).toString();
				myDate=(myDateObj.getDate()).toString();
				myHours=(myDateObj.getHours()).toString();
				myMinutes=(myDateObj.getMinutes()).toString();
				mySeconds=(myDateObj.getSeconds()).toString();
				this.count+=1;	
				return myYear+myMonth+myDate+myHours+myMinutes+mySeconds+this.count.toString()+'.'+$ext;						
		},
		/* 将二进制转换文本 */	
		toText:function($position,$length)
		{
			this.temp.type=1;
			this.temp.open();			
			this.stream.position=$position;
			this.stream.copyTo(this.temp,$length);				
			this.temp.position=0;
			this.temp.type=2;
			this.temp.charset=this.options.charSet;
			var text=this.temp.readText(-1);
			this.temp.close();
			text=text.replace(/\u0000/g,'');
			return text;
		},
		/* 文件夹监查者 */				
		folderObserver:function()
		{
			var folder=String(Server.MapPath(this.options.path)).split("\\");
			var fso_temp=Server.CreateObject('Scripting.FileSystemObject')
				var temp='';
				for(var ifolder=0;ifolder<=folder.length-1;ifolder++)
				{
					temp+=folder[ifolder]+'\\';
					if(ifolder>0)
					{			
						var tempFolder=temp.substr(0,temp.length-1);
						try
						{
							try
							{
								if(!fso_temp.FolderExists(temp.substr(0,temp.length-1))) fso_temp.CreateFolder(tempFolder);
							}catch(e)
							{}
							//echo(temp.substr(0,temp.length-1))
						}catch(e)
						{}
					}
				}
				fso_temp=null;
		},
		/* 扩展名验证 */
		isFileExt:function($ext)
		{				
			var isArray=(this.options.type.indexOf('/')!=-1),ext;
			(isArray) ? ext=this.options.type.split('/'):ext=this.options.type;		
			if(isArray)
			{
				for(var e=0;e<=this.options.type.split('/').length-1;e++)
				{	
					if(this.options.type.split('/')[e]==$ext)
						return true;
				}
				return false;
			}	
			else
			{
				return (this.options.type==$ext) ? true:false;	
			}	
		},
		/* 图象扩展名验证 */
		isImage:function($ext)
		{				
			var imageExt=['jpg','jpeg','gif','png','bmp'];
			for(var e=0;e<=imageExt.length-1;e++)
			{	
				if(imageExt[e]==$ext) return true;						
			}
			return false;
		},	
		/* 取得案例文件的信息 */			
		getFileInfo:function($position,$length)
		{
			var ret = [null, 0, 0], tmp, arr,isImage=false;
			this.temp.type=1;
			this.temp.open();			
			this.stream.position=$position;
			this.stream.copyTo(this.temp,$length);				
			this.temp.position=0,this.temp.type=2;								
			this.temp.charset="UTF-16BE";
			var tmp=this.temp.readText(12);	
			var arr=tmp.toBytes();
			if (arr[0] == 0x47 && arr[1] == 0x49 && arr[2] == 0x46)
			{
				ret[0] = "gif",isImage=true;
				ret[1] = arr[7] << 8|arr[6];
				ret[2] = arr[9] << 8|arr[8];					
			}
			else if (arr[6] == 0x4A && arr[7] == 0x46 && arr[8] == 0x49 && arr[9] == 0x46)
			{
				ret[0] = "jpg",isImage=true;
				this.temp.position = 3;
				arr = this.temp.readText(-1).toBytes();
				var i = 0, k = 0, j = 0;
				while (true)
				{
					while ((i = arr[j++]) == 255);
					if (j > arr.length) break;
					if (i > 191 && i < 196) break;
					k = (arr[j++]) << 8|arr[j++];
					if ((j += k - 2) > arr.length) break;
					while ((i = arr[j++]) < 255);
					if (j > arr.length) break;
				}
				j += 3;
				if (j + 4 < arr.length)
				{
					ret[2] = (arr[j++] << 8)|arr[j++];
					ret[1] = (arr[j++] << 8)|arr[j++];
				}
			}				
			else if (arr[1] == 0x50 && arr[2] == 0x4E && arr[3] == 0x47)
			{
				ret[0] = "png",isImage=true;
				ret[1] = arr[18] << 8|arr[19];
				ret[2] = arr[22] << 8|arr[23];
			}
			else if(arr[0] == 0x42 && arr[1] == 0x4D)
			{
				ret[0] = "bmp",isImage=true;
				ret[1] = arr[19] << 8|arr[18];
				ret[2] = arr[23] << 8|arr[22];
			}	
			this.temp.close();			
			return {isImage:isImage,ext:ret[0],width:ret[1],height:ret[2]};
		},	
		/* 删除文件 */
		deleteFile:function($path)
		{
			return FSO.deleteFile($path);
		},					
		/* 错误处理 */
		throwError:function($err)
		{
			switch($err)
			{
				case 1:
					var errorDescription='表单设置出错,请将表单的enctype属性值设置为multipart/form-data,以便组件能够正常工作';
					this.error=1,this.description=errorDescription;
					if(this.mode=='debug') doc(errorDescription),over();																		
					break;
				case 2:
					var errorDescription='表单无此控件';						
					this.error=2,this.description=errorDescription;						
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();									
					}
					break;	
				case 3:	
					var errorDescription='文件超过大小限制,单个文件的大小不能超过 '+this.options.maxSize+' 字节。';									
					this.error=3,this.description=errorDescription;						
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();					
					}
					break;
				case 4:
					var errorDescription='文件扩展名不对，只能是 '+this.options.type.replace(/\//g,' ')+' 其中的一种。';						
					this.error=4,this.description=errorDescription;
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();
					}											
					break;
				case 5:
					var errorDescription='自动上传文件失败';						
					this.error=5,this.description=errorDescription;
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();
					}	
					break;
				case 6:
					var errorDescription='一次性上传到服务器的文件总大小,不能超过'+this.options.totalSize+'字节.';						
					this.error=6,this.description=errorDescription;
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();
					}	
					break;
				case 7:
					var errorDescription='表单的请求方法,不是POST方法.';						
					this.error=7,this.description=errorDescription;
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();
					}	
					break;																		
				default:
					var errorDescription='发生意外未错误';						
					this.error=-1,this.description=errorDescription;
					if(this.mode=='debug') 
					{
						doc(errorDescription),over();
					}
			}
		},	
		/* 释放以象 */																		
		close:function()
		{
			this.options=null;
			this.formData=null,this.fileCdatalog=null,this.log=null;	
			this.error=null,this.errorDescription=null,this.mode=null;							
			this.stream.Close();
			delete this.stream;
			delete this.temp;		
		}			
	};
//-----------------------
	function $A($iterable) 
	{
		if(!$iterable) return [];
		if($iterable.toArray) return $iterable.toArray();
		var length=$iterable.length,results=new Array(length);
		while(length--) 
		{
			results[length]=$iterable[length];
		}
		return results;
	};	
	
	var Template=Class.create();
	Template.prototype=
	{
		
	  initialize:function($template,$pattern) 
	  {
		  this.template=$template.toString();
		  this.pattern=$pattern||Template.Pattern;
	  },	
	  evaluate:function($object) 
	  {
		  if(Object.isFunction($object.toTemplateReplacements))
		  {
			  $object=$object.toTemplateReplacements();
		  }				
		  return this.template.gsub
		  (
			  this.pattern,
			  function(match) 
			  {
				  if($object==null) return '';
				  
				  var before=match[1]||'';
				  if(before=='\\') return match[2];
				  
				  var ctx=$object,expr=match[3];
				  var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/,match=pattern.exec(expr);
				  if(match == null) return before;
				  
				  while(match!=null) 
				  {
					  var comp=match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
					  ctx=ctx[comp];
					  if(null==ctx||''== match[3]) break;
					  expr=expr.substring('[' == match[3] ? match[1].length : match[0].length);
					  match=pattern.exec(expr);
				  }						
				  return before+String.interpret(ctx);
			  }.bind(this)
		  );
	  }
	}
	Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;	// /(^|.|\r|\n)(\<%=\s*(\w+)\s*%\>)/
	
	function alert(v)
	{
		doc(v),over();	
	}
				
%>